Cleaned up GAMS and duplicated code
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
LIBRARIES += -L$(CODAC_ROOT)/lib/ -lpxi6528
|
|
||||||
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=NI6528.x
|
|
||||||
|
|
||||||
PACKAGE=DataSources
|
|
||||||
|
|
||||||
ROOT_DIR=../../../../obj
|
|
||||||
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$(CODAC_ROOT)/include/
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/NI6528$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/NI6528$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file NI6528.cpp
|
|
||||||
* @brief Source file for class NI6528
|
|
||||||
* @date 01/03/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 NI6528 (public, protected, and private). Be aware that some
|
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
#include "CompilerTypes.h"
|
|
||||||
#include "NI6528.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
NI6528::NI6528() :
|
|
||||||
MARTe::DataSourceI() {
|
|
||||||
using namespace MARTe;
|
|
||||||
previousValue = 0u;
|
|
||||||
value = 0u;
|
|
||||||
port = 0u;
|
|
||||||
boardFileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NI6528::~NI6528() {
|
|
||||||
using namespace MARTe;
|
|
||||||
(void) pxi6528_close_device(boardFileDescriptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::SetConfiguredDatabase(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (DataSourceI::SetConfiguredDatabase(data));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "DataSourceI::SetConfiguredDatabas() failed");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetNumberOfSignals() == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetNumberOfSignals() != 1u");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetSignalType(0u) == UnsignedInteger8Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetSignalType(0u) != UnsignedInteger8Bit");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = DataSourceI::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("Port", port);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The Port shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("DeviceName", deviceName);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The DeviceName shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int32 ret = pxi6528_open_device(&boardFileDescriptor, deviceName.Buffer(), O_NONBLOCK);
|
|
||||||
ok = (ret == 0);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString err = strerror(-ret);
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Could not open device (%s) : %s", deviceName.Buffer(), err.Buffer());
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::Synchronise() {
|
|
||||||
using namespace MARTe;
|
|
||||||
if(previousValue != value){
|
|
||||||
int32 ret = (pxi6528_write_port(boardFileDescriptor, port, value) > 0);
|
|
||||||
previousValue = value;
|
|
||||||
bool ok = (ret > -1);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString err = strerror(-ret);
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Could not write to device (%s) : %s", deviceName.Buffer(), err.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::AllocateMemory() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress) {
|
|
||||||
signalAddress = &value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MARTe::char8 *NI6528::GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction) {
|
|
||||||
using namespace MARTe;
|
|
||||||
return "MemoryMapSynchronisedOutputBroker";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(NI6528, "1.0")
|
|
||||||
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file NI6528.h
|
|
||||||
* @brief Header file for class NI6528
|
|
||||||
* @date 07/06/2018
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 NI6528
|
|
||||||
* 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 RANDOM_DATASOURCE_H_
|
|
||||||
#define RANDOM_DATASOURCE_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <pxi6528.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @brief NI6528 simplified data source implementation.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantities are only given as an example):
|
|
||||||
* +NI6528 = {
|
|
||||||
* Class = NI6528
|
|
||||||
* DeviceName = "/dev/pxi6528.0" //Mandatory
|
|
||||||
* Port = 0 //The port where to write
|
|
||||||
* Signals = {
|
|
||||||
* currentValue = {Type = uint8}
|
|
||||||
* bitmask = {Type = uint8}
|
|
||||||
* Value = {Type = uint8}
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
class NI6528: public MARTe::DataSourceI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Constructor. NOOP.
|
|
||||||
*/
|
|
||||||
NI6528 ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor. NOOP.
|
|
||||||
*/
|
|
||||||
virtual ~NI6528();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The configuration data detailed in the class description
|
|
||||||
* @return true if all the compulsory parameters are set.
|
|
||||||
*/
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Verifies that at most one signal has been set with the correct type (i.e. any integer).
|
|
||||||
* @return true if the above conditions are met.
|
|
||||||
*/
|
|
||||||
virtual bool SetConfiguredDatabase(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::Synchronise
|
|
||||||
*/
|
|
||||||
virtual bool Synchronise();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::AllocateMemory
|
|
||||||
*/
|
|
||||||
virtual bool AllocateMemory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::GetSignalMemoryBuffer
|
|
||||||
*/
|
|
||||||
virtual bool GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return "MemoryMapSynchronisedInputBroker"
|
|
||||||
*/
|
|
||||||
virtual const MARTe::char8 *GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief NOOP
|
|
||||||
*/
|
|
||||||
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* The previous value to write.
|
|
||||||
*/
|
|
||||||
MARTe::uint8 previousValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The bitmask to write value. (new value) = (current value) || (bitmask) && (write value)
|
|
||||||
*/
|
|
||||||
MARTe::uint8 bitmask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The value to write.
|
|
||||||
*/
|
|
||||||
MARTe::uint8 value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The port number
|
|
||||||
*/
|
|
||||||
MARTe::uint32 port;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The board file descriptor
|
|
||||||
*/
|
|
||||||
pxi6528_device_t boardFileDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The device name
|
|
||||||
*/
|
|
||||||
MARTe::StreamString deviceName;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* RANDOM_DATASOURCE_H_ */
|
|
||||||
|
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
* or implied. See the Licence permissions and limitations under the Licence.
|
* or implied. See the Licence permissions and limitations under the Licence.
|
||||||
|
|
||||||
* @details This source file contains the definition of all the methods for
|
* @details This source file contains the definition of all the methods for
|
||||||
* the class JAConditionalSignalUpdateGAM (public, protected, and private). Be aware that some
|
* the class JAConditionalSignalUpdateGAM (public, protected, and private). Be
|
||||||
|
aware that some
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
* methods, such as those inline could be defined on the header file, instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,8 +29,11 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Project header includes */
|
/* Project header includes */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "JAConditionalSignalUpdateGAM.h"
|
|
||||||
#include "AdvancedErrorManagement.h"
|
#include "AdvancedErrorManagement.h"
|
||||||
|
#include "Architecture/x86_gcc/CompilerTypes.h"
|
||||||
|
#include "ErrorType.h"
|
||||||
|
#include "JAConditionalSignalUpdateGAM.h"
|
||||||
|
#include "TypeDescriptor.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Static definitions */
|
/* Static definitions */
|
||||||
@@ -39,271 +43,269 @@
|
|||||||
/* Method definitions */
|
/* Method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
bool parse_comparator(const MARTe::StreamString &str,
|
||||||
|
JAConditionalSignalUpdateGAM::ComparisonMode &op) {
|
||||||
|
if (str == "EQUALS") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::Equals;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "NOT") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::Not;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "GREATER") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::Greater;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "EQUALS_OR_GREATER") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::EqualsOrGreater;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "LESS") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::Less;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "EQUALS_OR_LESS") {
|
||||||
|
op = JAConditionalSignalUpdateGAM::EqualsOrLess;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM::JAConditionalSignalUpdateGAM() {
|
JAConditionalSignalUpdateGAM::JAConditionalSignalUpdateGAM() {
|
||||||
inputSignals = NULL_PTR(void **);
|
inputSignals = NULL_PTR(void **);
|
||||||
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
||||||
values = NULL_PTR(MARTe::uint32 *);
|
comparators = NULL_PTR(comparator_t *);
|
||||||
valuesCount = 0u;
|
outputSignals = NULL_PTR(MARTe::uint32 **);
|
||||||
outputSignals = NULL_PTR(MARTe::uint32 **);
|
outputs = NULL_PTR(output_t *);
|
||||||
defaultValues = NULL_PTR(MARTe::uint32 **);
|
needsReset = false;
|
||||||
needsReset = false;
|
operation = And;
|
||||||
expectedValues = NULL_PTR(MARTe::uint32 *);
|
|
||||||
expectedValuesCount = 0u;
|
|
||||||
operation = And;
|
|
||||||
comparators = NULL_PTR(ComparisonMode *);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM::~JAConditionalSignalUpdateGAM() {
|
JAConditionalSignalUpdateGAM::~JAConditionalSignalUpdateGAM() {
|
||||||
if (outputSignals != NULL_PTR(MARTe::uint32 **)) {
|
if (outputSignals != NULL_PTR(MARTe::uint32 **)) {
|
||||||
delete[] outputSignals;
|
delete[] outputSignals;
|
||||||
}
|
}
|
||||||
if (inputSignals != NULL_PTR(void **)) {
|
if (inputSignals != NULL_PTR(void **)) {
|
||||||
delete[] inputSignals;
|
delete[] inputSignals;
|
||||||
}
|
}
|
||||||
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
||||||
delete[] inputSignalTypes;
|
delete[] inputSignalTypes;
|
||||||
}
|
}
|
||||||
if (values != NULL_PTR(MARTe::uint32 *)) {
|
if (outputs != NULL_PTR(output_t *)) {
|
||||||
delete[] values;
|
delete[] outputs;
|
||||||
}
|
}
|
||||||
if (comparators != NULL_PTR(ComparisonMode *)) {
|
if (comparators != NULL_PTR(comparator_t *)) {
|
||||||
delete[] comparators;
|
delete[] comparators;
|
||||||
}
|
}
|
||||||
if (defaultValues != NULL_PTR(MARTe::uint32 **)) {
|
|
||||||
delete[] defaultValues;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Initialise(MARTe::StructuredDataI & data) {
|
bool JAConditionalSignalUpdateGAM::Initialise(MARTe::StructuredDataI &data) {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = GAM::Initialise(data);
|
bool ok = GAM::Initialise(data);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// Read expected values.
|
MARTe::StreamString operationStr;
|
||||||
AnyType valuesArray = data.GetType("ExpectedValues");
|
if (data.Read("Operation", operationStr)) {
|
||||||
|
if (operationStr == "AND") {
|
||||||
if (valuesArray.GetDataPointer() != NULL) {
|
operation = And;
|
||||||
expectedValuesCount = valuesArray.GetNumberOfElements(0u);
|
} else if (operationStr == "OR") {
|
||||||
|
operation = Or;
|
||||||
expectedValues = new uint32[expectedValuesCount];
|
} else if (operationStr == "NOR") {
|
||||||
|
operation = Nor;
|
||||||
Vector<uint32> valuesVector(expectedValues, expectedValuesCount);
|
} else if (operationStr == "XOR") {
|
||||||
ok = (data.Read("ExpectedValues", valuesVector));
|
operation = Xor;
|
||||||
}
|
} else {
|
||||||
|
ok = false;
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Operation %s is not defined", operationStr.Buffer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
ok = data.MoveRelative("InputSignals");
|
||||||
|
uint32 level = 0;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// Read comparators.
|
level++;
|
||||||
AnyType comparatorsArray = data.GetType("Comparators");
|
uint32 n_inputs = data.GetNumberOfChildren();
|
||||||
if (comparatorsArray.GetDataPointer() != NULL) {
|
comparators = new comparator_t[n_inputs];
|
||||||
uint32 count;
|
StreamString buffer;
|
||||||
if (ok) {
|
TypeDescriptor td;
|
||||||
count = comparatorsArray.GetNumberOfElements(0u);
|
for (uint32 i = 0; ok && i < n_inputs; i++) {
|
||||||
ok = count == expectedValuesCount;
|
ok = data.MoveToChild(i);
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
comparators = new ComparisonMode[count];
|
|
||||||
StreamString* comp = new StreamString[count];
|
|
||||||
Vector<StreamString> compVector(comp, count);
|
|
||||||
|
|
||||||
ok = (data.Read("Comparators", compVector));
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
|
||||||
if (comp[i] == "EQUALS") {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
} else if (comp[i] == "NOT") {
|
|
||||||
comparators[i] = Not;
|
|
||||||
} else if (comp[i] == "GREATER") {
|
|
||||||
comparators[i] = Greater;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_GREATER") {
|
|
||||||
comparators[i] = EqualsOrGreater;
|
|
||||||
} else if (comp[i] == "LESS") {
|
|
||||||
comparators[i] = Less;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_LESS") {
|
|
||||||
comparators[i] = EqualsOrLess;
|
|
||||||
} else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Comparator %s is not defined.", comp[i].Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] comp;
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
|
||||||
"number of elements.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Create default comparators (equals) when they aren't provided in the configuration.
|
|
||||||
comparators = new ComparisonMode[expectedValuesCount];
|
|
||||||
for (uint32 i = 0; i < expectedValuesCount; ++i) {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
MARTe::StreamString operationStr;
|
|
||||||
if (data.Read("Operation", operationStr)) {
|
|
||||||
if (operationStr == "AND") {
|
|
||||||
operation = And;
|
|
||||||
}
|
|
||||||
else if (operationStr == "OR") {
|
|
||||||
operation = Or;
|
|
||||||
}
|
|
||||||
else if (operationStr == "NOR") {
|
|
||||||
operation = Nor;
|
|
||||||
}
|
|
||||||
else if (operationStr == "XOR") {
|
|
||||||
operation = Xor;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Operation %s is not defined", operationStr.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
// Read output signal values to be set.
|
|
||||||
AnyType valuesArray = data.GetType("Values");
|
|
||||||
ok = (valuesArray.GetDataPointer() != NULL);
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
valuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
ok = valuesCount > 0u;
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
values = new uint32[valuesCount];
|
|
||||||
|
|
||||||
Vector<uint32> valuesVector(values, valuesCount);
|
|
||||||
ok = (data.Read("Values", valuesVector));
|
|
||||||
}
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Values shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to InputSignals[%lu]", i);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
level++;
|
||||||
|
ok = data.Read("Type", buffer);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Missing mandatory field Type from InputSignals[%lu]",
|
||||||
|
i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
td = TypeDescriptor::GetTypeDescriptorFromTypeName(buffer.Buffer());
|
||||||
|
ok = (td == UnsignedInteger8Bit) || (td == UnsignedInteger16Bit) ||
|
||||||
|
(td == UnsignedInteger32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Wrong value for field Type from InputSignals[%lu]", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ok = data.Read("Comparator", buffer);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(
|
||||||
|
ErrorManagement::ParametersError,
|
||||||
|
"Missing mandatory field Comparator from InputSignals[%lu]", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ok = parse_comparator(buffer, comparators[i].comparator);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Non Valid Comparator `%s` from InputSignals[%lu]",
|
||||||
|
buffer, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ok = data.Read("Value", comparators[i].value);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(
|
||||||
|
ErrorManagement::ParametersError,
|
||||||
|
"Missing field Value (expecting int) from InputSignals[%lu]", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (data.MoveToAncestor(1)) {
|
||||||
|
level--;
|
||||||
|
} else {
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.MoveToAncestor(level);
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to InputSignals");
|
||||||
}
|
}
|
||||||
return ok;
|
}
|
||||||
|
if (ok) {
|
||||||
|
ok = data.MoveRelative("OutputSignals");
|
||||||
|
uint32 level = 0;
|
||||||
|
if (ok) {
|
||||||
|
level++;
|
||||||
|
uint32 n_outputs = data.GetNumberOfChildren();
|
||||||
|
outputs = new output_t[n_outputs];
|
||||||
|
for (uint32 i = 0; ok && i < n_outputs; i++) {
|
||||||
|
ok = data.MoveToChild(i);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to InputSignals[%lu]", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
level++;
|
||||||
|
ok = data.Read("DefaultValue", outputs[i].defaultValue);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to read field DefaultValue for output %lu",
|
||||||
|
i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ok = data.Read("Value", outputs[i].value);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to read field Value for output %lu", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ok = data.MoveToAncestor(1);
|
||||||
|
if (ok) {
|
||||||
|
level--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.MoveToAncestor(level);
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to OutputSignals");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Setup() {
|
bool JAConditionalSignalUpdateGAM::Setup() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = numberOfInputSignals == (expectedValuesCount + numberOfOutputSignals);
|
bool ok = numberOfInputSignals > 0;
|
||||||
|
if (ok) {
|
||||||
|
inputSignals = new void *[numberOfInputSignals];
|
||||||
|
uint32 i;
|
||||||
|
for (uint32 i = 0u; i < numberOfOutputSignals; i++) {
|
||||||
|
inputSignals[i] = GetInputSignalMemory(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Number of input signals shall be greater then 0 ");
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
ok = numberOfOutputSignals > 0u;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
inputSignals = new void*[expectedValuesCount];
|
outputSignals = new uint32 *[numberOfOutputSignals];
|
||||||
defaultValues = new uint32*[numberOfOutputSignals];
|
for (uint32 i = 0u; i < numberOfOutputSignals; i++) {
|
||||||
uint32 i;
|
outputSignals[i] = reinterpret_cast<uint32 *>(GetOutputSignalMemory(i));
|
||||||
for (i = 0u; i < expectedValuesCount; i++) {
|
}
|
||||||
inputSignals[i] = GetInputSignalMemory(i);
|
|
||||||
}
|
|
||||||
for (; i < numberOfInputSignals; i++) {
|
|
||||||
defaultValues[i - expectedValuesCount] = reinterpret_cast<uint32 *>(GetInputSignalMemory(i));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be equal to number "
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
"of expected values plus number of output signals.");
|
"At least one output signal shall be defined");
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
inputSignalTypes = new TypeDescriptor[expectedValuesCount];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; (i < expectedValuesCount) && (ok); i++) {
|
|
||||||
inputSignalTypes[i] = GetSignalType(InputSignals, i);
|
|
||||||
ok = ((inputSignalTypes[i] == UnsignedInteger32Bit) || (inputSignalTypes[i] == UnsignedInteger16Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or uint16", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfOutputSignals == valuesCount;
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfOutputSignals > 0u;
|
|
||||||
if (ok) {
|
|
||||||
outputSignals = new uint32*[numberOfOutputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; i++) {
|
|
||||||
outputSignals[i] = reinterpret_cast<uint32 *>(GetOutputSignalMemory(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of output signals shall be the same as "
|
|
||||||
"number of provided values.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
bool JAConditionalSignalUpdateGAM::PrepareNextState(
|
||||||
needsReset = false;
|
const MARTe::char8 *const currentStateName,
|
||||||
return true;
|
const MARTe::char8 *const nextStateName) {
|
||||||
|
needsReset = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool accumulate(JAConditionalSignalUpdateGAM::OperationMode mode, bool next,
|
||||||
|
bool current) {
|
||||||
|
switch (mode) {
|
||||||
|
case JAConditionalSignalUpdateGAM::Or:
|
||||||
|
return next || current;
|
||||||
|
case JAConditionalSignalUpdateGAM::And:
|
||||||
|
return next && current;
|
||||||
|
case JAConditionalSignalUpdateGAM::Nor:
|
||||||
|
return !(next || current);
|
||||||
|
case JAConditionalSignalUpdateGAM::Xor:
|
||||||
|
return (!next != !current);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Execute() {
|
bool JAConditionalSignalUpdateGAM::Execute() {
|
||||||
if (!needsReset) {
|
if (!needsReset) {
|
||||||
bool eventDetected = expectedValuesCount == 0;
|
bool state = Compare(0);
|
||||||
if (!eventDetected) {
|
for (MARTe::uint32 i = 1; i < numberOfInputSignals; i++) {
|
||||||
if (operation == Or) {
|
state = accumulate(operation, Compare(i), state);
|
||||||
MARTe::uint32 j;
|
|
||||||
for (j = 0; (j < expectedValuesCount) && (!eventDetected); j++) {
|
|
||||||
eventDetected = Compare(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Nor) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
for (j = 0; (j < expectedValuesCount) && (!eventDetected); j++) {
|
|
||||||
eventDetected = Compare(j);
|
|
||||||
}
|
|
||||||
eventDetected = !eventDetected;
|
|
||||||
}
|
|
||||||
else if (operation == And) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
eventDetected = Compare(0);
|
|
||||||
for (j = 1; (j < expectedValuesCount); j++) {
|
|
||||||
eventDetected &= Compare(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Xor) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
MARTe::uint32 eventDetectedUint32;
|
|
||||||
if (inputSignalTypes[0] == MARTe::UnsignedInteger32Bit) {
|
|
||||||
eventDetectedUint32 = *static_cast<MARTe::uint32 *>(inputSignals[0]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
eventDetectedUint32 = *static_cast<MARTe::uint16 *>(inputSignals[0]);
|
|
||||||
}
|
|
||||||
for (j = 1; (j < expectedValuesCount); j++) {
|
|
||||||
eventDetectedUint32 ^= Compare(j);
|
|
||||||
}
|
|
||||||
eventDetected = (eventDetectedUint32 == 1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (eventDetected) {
|
|
||||||
needsReset = true;
|
|
||||||
MARTe::uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
|
||||||
*outputSignals[i] = values[i];
|
|
||||||
MARTe::StreamString signalName;
|
|
||||||
(void) GetSignalName(MARTe::OutputSignals, i, signalName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MARTe::uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
|
||||||
*outputSignals[i] = *defaultValues[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
if (state) {
|
||||||
|
needsReset = true;
|
||||||
|
MARTe::uint32 i;
|
||||||
|
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
||||||
|
*outputSignals[i] = outputs[i].value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MARTe::uint32 i;
|
||||||
|
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
||||||
|
*outputSignals[i] = outputs[i].defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
||||||
if (inputSignalTypes[index] == MARTe::UnsignedInteger32Bit) {
|
if (inputSignalTypes[index] == MARTe::UnsignedInteger32Bit) {
|
||||||
return Compare<MARTe::uint32>(index);
|
return Compare<MARTe::uint32>(index);
|
||||||
}
|
}
|
||||||
return Compare<MARTe::uint16>(index);
|
return Compare<MARTe::uint16>(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLASS_REGISTER(JAConditionalSignalUpdateGAM, "1.0")
|
CLASS_REGISTER(JAConditionalSignalUpdateGAM, "1.0")
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
* or implied. See the Licence permissions and limitations under the Licence.
|
* or implied. See the Licence permissions and limitations under the Licence.
|
||||||
|
|
||||||
* @details This header file contains the declaration of the class JAConditionalSignalUpdateGAM
|
* @details This header file contains the declaration of the class
|
||||||
|
JAConditionalSignalUpdateGAM
|
||||||
* with all of its public, protected and private members. It may also include
|
* 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.
|
* definitions for inline methods which need to be visible to the compiler.
|
||||||
*/
|
*/
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Project header includes */
|
/* Project header includes */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#include "Architecture/x86_gcc/CompilerTypes.h"
|
||||||
#include "GAM.h"
|
#include "GAM.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@@ -38,20 +40,24 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GAM that writes predefined values to output signals when a condition is met.
|
* @brief GAM that writes predefined values to output signals when a condition
|
||||||
* If there are no conditional signals provided, the condition is presumed to be met.
|
* is met. If there are no conditional signals provided, the condition is
|
||||||
|
* presumed to be met.
|
||||||
*
|
*
|
||||||
* +ASYNCShotlengthControlGAM = {
|
* +ASYNCShotlengthControlGAM = {
|
||||||
* Class = JAConditionalSignalUpdateGAM
|
* Class = JAConditionalSignalUpdateGAM
|
||||||
* Operation = OR // Logical operation performed between conditional signals
|
* Operation = OR // Logical operation performed between conditional
|
||||||
|
* signals
|
||||||
* // Supported values: AND, OR, XOR, NOR
|
* // Supported values: AND, OR, XOR, NOR
|
||||||
* // Default: AND
|
* // Default: AND
|
||||||
* ExpectedValues = {1 1} // Values to which conditional signals will be compared.
|
* ExpectedValues = {1 1} // Values to which conditional signals will
|
||||||
* Comparators = {EQUALS EQUALS} // Operator between conditional signal an expected value
|
* be compared. Comparators = {EQUALS EQUALS} // Operator between conditional
|
||||||
* // Supported values: EQUALS, NOT, GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
|
* signal an expected value
|
||||||
|
* // Supported values: EQUALS, NOT,
|
||||||
|
* GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
|
||||||
* // Default: EQUALS
|
* // Default: EQUALS
|
||||||
* Values = {0 3} // Values that will be written to output signals when condition is met.
|
* Values = {0 3} // Values that will be written to output signals when
|
||||||
* InputSignals = {
|
* condition is met. InputSignals = {
|
||||||
* // Conditional Signals
|
* // Conditional Signals
|
||||||
* SHOTLEN_FLAG = {
|
* SHOTLEN_FLAG = {
|
||||||
* DataSource = DDB1
|
* DataSource = DDB1
|
||||||
@@ -61,15 +67,13 @@
|
|||||||
* DataSource = DDB1
|
* DataSource = DDB1
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
* }
|
* }
|
||||||
* // Default values (set to output signals before the condition is met)
|
* // Default values (set to output signals before the condition is
|
||||||
* APS_SWON = { // APS_SWON will keep the value from previous state.
|
* met) APS_SWON = { // APS_SWON will keep the value from previous state.
|
||||||
* DataSource = DDB1
|
* DataSource = DDB1
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
* }
|
* }
|
||||||
* BPS_SWON_DEFAULT = { // BPS_SWON will be set to 7 before condition is met.
|
* BPS_SWON_DEFAULT = { // BPS_SWON will be set to 7 before
|
||||||
* DataSource = DDB1
|
* condition is met. DataSource = DDB1 Type = uint32 Default = 7
|
||||||
* Type = uint32
|
|
||||||
* Default = 7
|
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* OutputSignals = {
|
* OutputSignals = {
|
||||||
@@ -84,97 +88,96 @@
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
class JAConditionalSignalUpdateGAM : public MARTe::GAM, public MARTe::StatefulI {
|
class JAConditionalSignalUpdateGAM : public MARTe::GAM,
|
||||||
|
public MARTe::StatefulI {
|
||||||
public:
|
public:
|
||||||
CLASS_REGISTER_DECLARATION()
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM();
|
JAConditionalSignalUpdateGAM();
|
||||||
|
|
||||||
virtual ~JAConditionalSignalUpdateGAM();
|
virtual ~JAConditionalSignalUpdateGAM();
|
||||||
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
virtual bool Initialise(MARTe::StructuredDataI &data);
|
||||||
|
|
||||||
virtual bool Setup();
|
virtual bool Setup();
|
||||||
|
|
||||||
virtual bool Execute();
|
virtual bool Execute();
|
||||||
|
|
||||||
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName,
|
virtual bool PrepareNextState(const MARTe::char8 *const currentStateName,
|
||||||
const MARTe::char8 * const nextStateName);
|
const MARTe::char8 *const nextStateName);
|
||||||
|
|
||||||
|
enum ComparisonMode {
|
||||||
|
Equals,
|
||||||
|
Not,
|
||||||
|
Greater,
|
||||||
|
EqualsOrGreater,
|
||||||
|
Less,
|
||||||
|
EqualsOrLess
|
||||||
|
};
|
||||||
|
enum OperationMode { And, Or, Xor, Nor };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Does the input signal at provided index have the expected value.
|
* @brief Does the input signal at provided index have the expected value.
|
||||||
* @param[in] index of the signal.
|
* @param[in] index of the signal.
|
||||||
* @return true if the signal has expected value.
|
* @return true if the signal has expected value.
|
||||||
*/
|
*/
|
||||||
bool Compare(MARTe::uint32 index);
|
bool Compare(MARTe::uint32 index);
|
||||||
|
|
||||||
template <class T>
|
template <class T> bool Compare(MARTe::uint32 index);
|
||||||
bool Compare(MARTe::uint32 index);
|
|
||||||
|
|
||||||
enum OperationMode {
|
|
||||||
And, Or, Xor, Nor
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ComparisonMode {
|
// Input signals
|
||||||
Equals, Not, Greater, EqualsOrGreater, Less, EqualsOrLess
|
void **inputSignals;
|
||||||
};
|
|
||||||
|
|
||||||
// Input signals
|
MARTe::TypeDescriptor *inputSignalTypes;
|
||||||
void **inputSignals;
|
struct comparator_t {
|
||||||
|
ComparisonMode comparator;
|
||||||
|
MARTe::uint32 value;
|
||||||
|
};
|
||||||
|
comparator_t *comparators;
|
||||||
|
// Condition operation.
|
||||||
|
OperationMode operation;
|
||||||
|
|
||||||
MARTe::TypeDescriptor *inputSignalTypes;
|
// Output signals
|
||||||
|
MARTe::uint32 **outputSignals;
|
||||||
|
struct output_t {
|
||||||
|
MARTe::uint32 value;
|
||||||
|
MARTe::uint32 defaultValue;
|
||||||
|
};
|
||||||
|
output_t *outputs;
|
||||||
|
|
||||||
// Condition operation.
|
// Were output signals already set and we are waiting for a state change
|
||||||
OperationMode operation;
|
// before they are set again.
|
||||||
|
bool needsReset;
|
||||||
// Array of expected values of input signals.
|
|
||||||
MARTe::uint32* expectedValues;
|
|
||||||
|
|
||||||
// Expected values count (must be equal to numberOfInputSignals)
|
|
||||||
MARTe::uint32 expectedValuesCount;
|
|
||||||
|
|
||||||
// Array of comparators
|
|
||||||
ComparisonMode* comparators;
|
|
||||||
|
|
||||||
// Values to be written on output signals when input signal has the expected value.
|
|
||||||
MARTe::uint32 *values;
|
|
||||||
|
|
||||||
// Number of values (must be equal to numberOfOutputSignals)
|
|
||||||
MARTe::uint32 valuesCount;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint32 **outputSignals;
|
|
||||||
|
|
||||||
// Default values of output signals
|
|
||||||
MARTe::uint32 **defaultValues;
|
|
||||||
|
|
||||||
// Were output signals already set and we are waiting for a state change before they are set again.
|
|
||||||
bool needsReset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Inline method definitions */
|
/* Inline method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
||||||
switch (comparators[index]) {
|
switch (comparators[index].comparator) {
|
||||||
case Equals:
|
case Equals:
|
||||||
return *static_cast<T *>(inputSignals[index]) == static_cast<T>(expectedValues[index]);
|
return *static_cast<T *>(inputSignals[index]) ==
|
||||||
case Not:
|
static_cast<T>(comparators[index].value);
|
||||||
return *static_cast<T *>(inputSignals[index]) != static_cast<T>(expectedValues[index]);
|
case Not:
|
||||||
case Greater:
|
return *static_cast<T *>(inputSignals[index]) !=
|
||||||
return *static_cast<T *>(inputSignals[index]) > static_cast<T>(expectedValues[index]);
|
static_cast<T>(comparators[index].value);
|
||||||
case EqualsOrGreater:
|
case Greater:
|
||||||
return *static_cast<T *>(inputSignals[index]) >= static_cast<T>(expectedValues[index]);
|
return *static_cast<T *>(inputSignals[index]) >
|
||||||
case Less:
|
static_cast<T>(comparators[index].value);
|
||||||
return *static_cast<T *>(inputSignals[index]) < static_cast<T>(expectedValues[index]);
|
case EqualsOrGreater:
|
||||||
default: // case EqualsOrLess:
|
return *static_cast<T *>(inputSignals[index]) >=
|
||||||
return *static_cast<T *>(inputSignals[index]) <= static_cast<T>(expectedValues[index]);
|
static_cast<T>(comparators[index].value);
|
||||||
}
|
case Less:
|
||||||
|
return *static_cast<T *>(inputSignals[index]) <
|
||||||
|
static_cast<T>(comparators[index].value);
|
||||||
|
default: // case EqualsOrLess:
|
||||||
|
return *static_cast<T *>(inputSignals[index]) <=
|
||||||
|
static_cast<T>(comparators[index].value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GAMS_JACONDITIONALSIGNALUPDATEGAM_H_ */
|
#endif /* GAMS_JACONDITIONALSIGNALUPDATEGAM_H_ */
|
||||||
|
|||||||
@@ -29,8 +29,12 @@
|
|||||||
/* Project header includes */
|
/* Project header includes */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include "AdvancedErrorManagement.h"
|
#include "AdvancedErrorManagement.h"
|
||||||
|
#include "Architecture/x86_gcc/CompilerTypes.h"
|
||||||
|
#include "ErrorType.h"
|
||||||
#include "JAMessageGAM.h"
|
#include "JAMessageGAM.h"
|
||||||
#include "MessageI.h"
|
#include "MessageI.h"
|
||||||
|
#include "StreamString.h"
|
||||||
|
#include "TypeDescriptor.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Static definitions */
|
/* Static definitions */
|
||||||
@@ -40,308 +44,336 @@
|
|||||||
/* Method definitions */
|
/* Method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class T, class U>
|
template <class T, class U>
|
||||||
bool Compare(JAMessageGAM::ComparisonMode comparator, void *inputSignal, U expectedValue) {
|
bool Compare(JAMessageGAM::ComparisonMode comparator, void *inputSignal,
|
||||||
switch (comparator) {
|
U expectedValue) {
|
||||||
case JAMessageGAM::Equals:
|
switch (comparator) {
|
||||||
return *static_cast<T *>(inputSignal) == expectedValue;
|
case JAMessageGAM::Equals:
|
||||||
case JAMessageGAM::Not:
|
return *static_cast<T *>(inputSignal) == expectedValue;
|
||||||
return *static_cast<T *>(inputSignal) != expectedValue;
|
case JAMessageGAM::Not:
|
||||||
case JAMessageGAM::Greater:
|
return *static_cast<T *>(inputSignal) != expectedValue;
|
||||||
return *static_cast<T *>(inputSignal) > expectedValue;
|
case JAMessageGAM::Greater:
|
||||||
case JAMessageGAM::EqualsOrGreater:
|
return *static_cast<T *>(inputSignal) > expectedValue;
|
||||||
return *static_cast<T *>(inputSignal) >= expectedValue;
|
case JAMessageGAM::EqualsOrGreater:
|
||||||
case JAMessageGAM::Less:
|
return *static_cast<T *>(inputSignal) >= expectedValue;
|
||||||
return *static_cast<T *>(inputSignal) < expectedValue;
|
case JAMessageGAM::Less:
|
||||||
default: // case EqualsOrLess:
|
return *static_cast<T *>(inputSignal) < expectedValue;
|
||||||
return *static_cast<T *>(inputSignal) <= expectedValue;
|
default: // case EqualsOrLess:
|
||||||
}
|
return *static_cast<T *>(inputSignal) <= expectedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool parse_comparator(const MARTe::StreamString &str,
|
||||||
|
JAMessageGAM::ComparisonMode &op) {
|
||||||
|
if (str == "EQUALS") {
|
||||||
|
op = JAMessageGAM::Equals;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "NOT") {
|
||||||
|
op = JAMessageGAM::Not;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "GREATER") {
|
||||||
|
op = JAMessageGAM::Greater;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "EQUALS_OR_GREATER") {
|
||||||
|
op = JAMessageGAM::EqualsOrGreater;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "LESS") {
|
||||||
|
op = JAMessageGAM::Less;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (str == "EQUALS_OR_LESS") {
|
||||||
|
op = JAMessageGAM::EqualsOrLess;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_int(const MARTe::TypeDescriptor &td) {
|
||||||
|
return (td == MARTe::UnsignedInteger32Bit) ||
|
||||||
|
(td == MARTe::SignedInteger32Bit) ||
|
||||||
|
(td == MARTe::UnsignedInteger16Bit) ||
|
||||||
|
(td == MARTe::SignedInteger16Bit) ||
|
||||||
|
(td == MARTe::UnsignedInteger8Bit) || (td == MARTe::SignedInteger8Bit);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_float(const MARTe::TypeDescriptor &td) {
|
||||||
|
return (td == MARTe::Float32Bit) || (td == MARTe::Float64Bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
JAMessageGAM::JAMessageGAM() {
|
JAMessageGAM::JAMessageGAM() {
|
||||||
inputSignals = NULL_PTR(void **);
|
inputSignals = NULL_PTR(void **);
|
||||||
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
||||||
operation = And;
|
comparators = NULL_PTR(comparator_t *);
|
||||||
needsReset = false;
|
operation = And;
|
||||||
expectedValuesInt = NULL_PTR(MARTe::uint64 *);
|
needsReset = false;
|
||||||
expectedValuesFloat = NULL_PTR(MARTe::float64 *);
|
|
||||||
intValuesCount = 0u;
|
|
||||||
floatValuesCount = 0u;
|
|
||||||
comparators = NULL_PTR(ComparisonMode *);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JAMessageGAM::~JAMessageGAM() {
|
JAMessageGAM::~JAMessageGAM() {
|
||||||
if (inputSignals != NULL_PTR(void **)) {
|
if (inputSignals != NULL_PTR(void **)) {
|
||||||
delete[] inputSignals;
|
delete[] inputSignals;
|
||||||
}
|
}
|
||||||
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
||||||
delete[] inputSignalTypes;
|
delete[] inputSignalTypes;
|
||||||
}
|
}
|
||||||
if (expectedValuesInt != NULL_PTR(MARTe::uint64 *)) {
|
if (comparators != NULL_PTR(comparator_t *)) {
|
||||||
delete[] expectedValuesInt;
|
delete[] comparators;
|
||||||
}
|
}
|
||||||
if (expectedValuesFloat != NULL_PTR(MARTe::float64 *)) {
|
|
||||||
delete[] expectedValuesFloat;
|
|
||||||
}
|
|
||||||
if (comparators != NULL_PTR(ComparisonMode *)) {
|
|
||||||
delete[] comparators;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAMessageGAM::Initialise(MARTe::StructuredDataI & data) {
|
bool JAMessageGAM::Initialise(MARTe::StructuredDataI &data) {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = GAM::Initialise(data);
|
bool ok = GAM::Initialise(data);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// Read expected integer values.
|
MARTe::StreamString operationStr;
|
||||||
AnyType valuesArray = data.GetType("ExpectedIntValues");
|
if (data.Read("Operation", operationStr)) {
|
||||||
bool intValuesProvided = (valuesArray.GetDataPointer() != NULL);
|
if (operationStr == "AND") {
|
||||||
|
operation = And;
|
||||||
if (intValuesProvided) {
|
} else if (operationStr == "OR") {
|
||||||
intValuesCount = valuesArray.GetNumberOfElements(0u);
|
operation = Or;
|
||||||
}
|
} else if (operationStr == "NOR") {
|
||||||
if (intValuesProvided) {
|
operation = Nor;
|
||||||
expectedValuesInt = new uint64[intValuesCount];
|
} else if (operationStr == "XOR") {
|
||||||
|
operation = Xor;
|
||||||
Vector<uint64> valuesVector(expectedValuesInt, intValuesCount);
|
} else {
|
||||||
ok = (data.Read("ExpectedIntValues", valuesVector));
|
ok = false;
|
||||||
if (!ok) {
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Failed to read ExpectedIntValues.");
|
"Operation %s is not defined", operationStr.Buffer());
|
||||||
return ok;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// Read expected float values.
|
|
||||||
valuesArray = data.GetType("ExpectedFloatValues");
|
|
||||||
bool floatValuesProvided = (valuesArray.GetDataPointer() != NULL);
|
|
||||||
|
|
||||||
if (floatValuesProvided) {
|
|
||||||
floatValuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
}
|
|
||||||
if (floatValuesProvided) {
|
|
||||||
expectedValuesFloat = new float64[floatValuesCount];
|
|
||||||
|
|
||||||
Vector<float64> valuesVector(expectedValuesFloat, floatValuesCount);
|
|
||||||
ok = (data.Read("ExpectedFloatValues", valuesVector));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Failed to read ExpectedFloatValues.");
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ok = (floatValuesCount + intValuesCount) > 0u;
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "ExpectedFloatValues and or ExpectedIntValues shall be defined.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
ok = (Size() == 1);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"A Message object shall be added to this container");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
eventMsg = Get(0);
|
||||||
|
ok = (eventMsg.IsValid());
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"A valid Message shall be added to this container");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
ok = data.MoveRelative("InputSignals");
|
||||||
|
uint32 level = 0;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// Read comparators.
|
level++;
|
||||||
AnyType comparatorsArray = data.GetType("Comparators");
|
uint32 n_inputs = data.GetNumberOfChildren();
|
||||||
if (comparatorsArray.GetDataPointer() != NULL) {
|
comparators = new comparator_t[n_inputs];
|
||||||
uint32 count = comparatorsArray.GetNumberOfElements(0u);
|
StreamString buffer;
|
||||||
ok = count == (intValuesCount + floatValuesCount);
|
TypeDescriptor td;
|
||||||
if (ok) {
|
for (uint32 i = 0; ok && i < n_inputs; i++) {
|
||||||
comparators = new ComparisonMode[count];
|
ok = data.MoveToChild(i);
|
||||||
StreamString* comp = new StreamString[count];
|
if (!ok) {
|
||||||
Vector<StreamString> compVector(comp, count);
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to InputSignals[%lu]", i);
|
||||||
ok = (data.Read("Comparators", compVector));
|
break;
|
||||||
|
}
|
||||||
if (ok) {
|
level++;
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
ok = data.Read("Type", buffer);
|
||||||
if (comp[i] == "EQUALS") {
|
if (!ok) {
|
||||||
comparators[i] = Equals;
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
} else if (comp[i] == "NOT") {
|
"Missing mandatory field Type from InputSignals[%lu]",
|
||||||
comparators[i] = Not;
|
i);
|
||||||
} else if (comp[i] == "GREATER") {
|
break;
|
||||||
comparators[i] = Greater;
|
}
|
||||||
} else if (comp[i] == "EQUALS_OR_GREATER") {
|
td = TypeDescriptor::GetTypeDescriptorFromTypeName(buffer.Buffer());
|
||||||
comparators[i] = EqualsOrGreater;
|
ok = (td != InvalidType) && (is_float(td) || is_int(td));
|
||||||
} else if (comp[i] == "LESS") {
|
if (!ok) {
|
||||||
comparators[i] = Less;
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
} else if (comp[i] == "EQUALS_OR_LESS") {
|
"Wrong value for field Type from InputSignals[%lu]", i);
|
||||||
comparators[i] = EqualsOrLess;
|
break;
|
||||||
} else {
|
}
|
||||||
ok = false;
|
ok = data.Read("Comparator", buffer);
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Comparator %s is not defined.", comp[i].Buffer());
|
if (!ok) {
|
||||||
}
|
REPORT_ERROR(
|
||||||
}
|
ErrorManagement::ParametersError,
|
||||||
}
|
"Missing mandatory field Comparator from InputSignals[%lu]", i);
|
||||||
} else {
|
break;
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
}
|
||||||
"number of elements.");
|
ok = parse_comparator(buffer, comparators[i].comparator);
|
||||||
}
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Non Valid Comparator `%s` from InputSignals[%lu]",
|
||||||
|
buffer, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (is_int(td)) {
|
||||||
|
ok = data.Read("Value", comparators[i].value.i64);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(
|
||||||
|
ErrorManagement::ParametersError,
|
||||||
|
"Missing field Value (expecting int) from InputSignals[%lu]",
|
||||||
|
i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uint32 count = intValuesCount + floatValuesCount;
|
ok = data.Read("Value", comparators[i].value.f64);
|
||||||
if (ok) {
|
if (!ok) {
|
||||||
// Create default comparators (equals) when they aren't provided in the configuration.
|
REPORT_ERROR(
|
||||||
comparators = new ComparisonMode[count];
|
ErrorManagement::ParametersError,
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
"Missing field Value (expecting float) from InputSignals[%lu]",
|
||||||
comparators[i] = Equals;
|
i);
|
||||||
}
|
break;
|
||||||
} else {
|
}
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
|
||||||
"number of elements.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (data.MoveToAncestor(1)) {
|
||||||
if (ok) {
|
level--;
|
||||||
MARTe::StreamString operationStr;
|
|
||||||
if (data.Read("Operation", operationStr)) {
|
|
||||||
if (operationStr == "AND") {
|
|
||||||
operation = And;
|
|
||||||
}
|
|
||||||
else if (operationStr == "OR") {
|
|
||||||
operation = Or;
|
|
||||||
}
|
|
||||||
else if (operationStr == "NOR") {
|
|
||||||
operation = Nor;
|
|
||||||
}
|
|
||||||
else if (operationStr == "XOR") {
|
|
||||||
operation = Xor;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Operation %s is not defined", operationStr.Buffer());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
data.MoveToAncestor(level);
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Impossible to move to InputSignals");
|
||||||
}
|
}
|
||||||
if (ok) {
|
}
|
||||||
ok = (Size() == 1);
|
return ok;
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "A Message object shall be added to this container");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
eventMsg = Get(0);
|
|
||||||
ok = (eventMsg.IsValid());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "A valid Message shall be added to this container");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAMessageGAM::Setup() {
|
bool JAMessageGAM::Setup() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = numberOfInputSignals == (intValuesCount + floatValuesCount);
|
bool ok = numberOfInputSignals > 0u;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ok = numberOfInputSignals > 0u;
|
inputSignals = new void *[numberOfInputSignals];
|
||||||
if (ok) {
|
uint32 i;
|
||||||
inputSignals = new void*[numberOfInputSignals];
|
for (i = 0u; i < numberOfInputSignals; i++) {
|
||||||
uint32 i;
|
inputSignals[i] = GetInputSignalMemory(i);
|
||||||
for (i = 0u; i < numberOfInputSignals; i++) {
|
|
||||||
inputSignals[i] = GetInputSignalMemory(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one input signal shall be defined");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be the same as "
|
|
||||||
"number of expected values.");
|
|
||||||
}
|
}
|
||||||
if (ok) {
|
} else {
|
||||||
inputSignalTypes = new TypeDescriptor[numberOfInputSignals];
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
uint32 i;
|
"At least one input signal shall be defined");
|
||||||
for (i = 0u; (i < numberOfInputSignals) && (ok); i++) {
|
}
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, i);
|
if (ok) {
|
||||||
inputSignalTypes[i] = inputType;
|
inputSignalTypes = new TypeDescriptor[numberOfInputSignals];
|
||||||
ok = (inputType == UnsignedInteger32Bit) || (inputType == SignedInteger32Bit) ||
|
uint32 i;
|
||||||
(inputType == UnsignedInteger16Bit) || (inputType == SignedInteger16Bit) ||
|
for (i = 0u; (i < numberOfInputSignals) && (ok); i++) {
|
||||||
(inputType == UnsignedInteger8Bit) || (inputType == SignedInteger8Bit) ||
|
TypeDescriptor inputType = GetSignalType(InputSignals, i);
|
||||||
(inputType == Float64Bit) || (inputType == Float32Bit);
|
inputSignalTypes[i] = inputType;
|
||||||
if (!ok) {
|
ok = (inputType == UnsignedInteger32Bit) ||
|
||||||
StreamString signalName;
|
(inputType == SignedInteger32Bit) ||
|
||||||
(void) GetSignalName(InputSignals, i, signalName);
|
(inputType == UnsignedInteger16Bit) ||
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal %s shall be defined as 32/16/8 bit signed/unsigned integer "
|
(inputType == SignedInteger16Bit) ||
|
||||||
"or as 64/32 float.", signalName.Buffer());
|
(inputType == UnsignedInteger8Bit) ||
|
||||||
}
|
(inputType == SignedInteger8Bit) || (inputType == Float64Bit) ||
|
||||||
}
|
(inputType == Float32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
StreamString signalName;
|
||||||
|
(void)GetSignalName(InputSignals, i, signalName);
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal %s shall be defined as 32/16/8 bit "
|
||||||
|
"signed/unsigned integer "
|
||||||
|
"or as 64/32 float.",
|
||||||
|
signalName.Buffer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAMessageGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
bool JAMessageGAM::PrepareNextState(const MARTe::char8 *const currentStateName,
|
||||||
needsReset = false;
|
const MARTe::char8 *const nextStateName) {
|
||||||
return true;
|
needsReset = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAMessageGAM::Execute() {
|
bool JAMessageGAM::Execute() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
bool eventDetected = false;
|
bool eventDetected = false;
|
||||||
uint32 inputPortIndex = 0;
|
uint32 inputPortIndex = 0;
|
||||||
uint32 intIndex = 0;
|
uint32 intIndex = 0;
|
||||||
uint32 floatIndex = 0;
|
uint32 floatIndex = 0;
|
||||||
if (operation == Or) {
|
if (operation == Or) {
|
||||||
for (inputPortIndex = 0; (inputPortIndex < numberOfInputSignals) && (!eventDetected); inputPortIndex++) {
|
for (inputPortIndex = 0;
|
||||||
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
(inputPortIndex < numberOfInputSignals) && (!eventDetected);
|
||||||
}
|
inputPortIndex++) {
|
||||||
|
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
||||||
}
|
}
|
||||||
else if (operation == Nor) {
|
} else if (operation == Nor) {
|
||||||
for (inputPortIndex = 0; (inputPortIndex < numberOfInputSignals) && (!eventDetected); inputPortIndex++) {
|
for (inputPortIndex = 0;
|
||||||
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
(inputPortIndex < numberOfInputSignals) && (!eventDetected);
|
||||||
}
|
inputPortIndex++) {
|
||||||
eventDetected = !eventDetected;
|
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
||||||
}
|
}
|
||||||
else if (operation == And) {
|
eventDetected = !eventDetected;
|
||||||
eventDetected = Compare(0, floatIndex, intIndex);
|
} else if (operation == And) {
|
||||||
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals); inputPortIndex++) {
|
eventDetected = Compare(0, floatIndex, intIndex);
|
||||||
eventDetected &= Compare(inputPortIndex, floatIndex, intIndex);
|
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals);
|
||||||
}
|
inputPortIndex++) {
|
||||||
|
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
||||||
}
|
}
|
||||||
else if (operation == Xor) {
|
} else if (operation == Xor) {
|
||||||
uint32 eventDetectedUInt32 = Compare(inputPortIndex, floatIndex, intIndex);
|
uint32 eventDetectedUInt32 = Compare(inputPortIndex, floatIndex, intIndex);
|
||||||
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals); inputPortIndex++) {
|
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals);
|
||||||
eventDetectedUInt32 ^= Compare(inputPortIndex, floatIndex, intIndex);
|
inputPortIndex++) {
|
||||||
}
|
eventDetectedUInt32 ^= Compare(inputPortIndex, floatIndex, intIndex);
|
||||||
eventDetected = (eventDetectedUInt32 == 1u);
|
|
||||||
}
|
}
|
||||||
if (eventDetected) {
|
eventDetected = (eventDetectedUInt32 == 1u);
|
||||||
if (!needsReset) {
|
}
|
||||||
ok = (MessageI::SendMessage(eventMsg, this) == ErrorManagement::NoError);
|
if (eventDetected) {
|
||||||
needsReset = true;
|
if (!needsReset) {
|
||||||
}
|
ok = (MessageI::SendMessage(eventMsg, this) == ErrorManagement::NoError);
|
||||||
|
needsReset = true;
|
||||||
}
|
}
|
||||||
return ok;
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JAMessageGAM::Compare(MARTe::uint32 inputPortIndex, MARTe::uint32 &floatValueIndex, MARTe::uint32 &intValueIndex) {
|
bool JAMessageGAM::Compare(MARTe::uint32 inputPortIndex,
|
||||||
using namespace MARTe;
|
MARTe::uint32 &floatValueIndex,
|
||||||
bool ret = false;
|
MARTe::uint32 &intValueIndex) {
|
||||||
if (inputSignalTypes[inputPortIndex] == UnsignedInteger32Bit) {
|
using namespace MARTe;
|
||||||
ret = ::Compare<uint32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
bool ret = false;
|
||||||
++intValueIndex;
|
if (inputSignalTypes[inputPortIndex] == UnsignedInteger32Bit) {
|
||||||
}
|
ret = ::Compare<uint32>(comparators[inputPortIndex].comparator,
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger32Bit) {
|
inputSignals[inputPortIndex],
|
||||||
ret = ::Compare<int32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
comparators[inputPortIndex].value.i64);
|
||||||
++intValueIndex;
|
++intValueIndex;
|
||||||
}
|
} else if (inputSignalTypes[inputPortIndex] == SignedInteger32Bit) {
|
||||||
else if (inputSignalTypes[inputPortIndex] == UnsignedInteger16Bit) {
|
ret = ::Compare<int32>(comparators[inputPortIndex].comparator,
|
||||||
ret = ::Compare<uint16>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
inputSignals[inputPortIndex],
|
||||||
++intValueIndex;
|
comparators[inputPortIndex].value.i64);
|
||||||
}
|
++intValueIndex;
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger16Bit) {
|
} else if (inputSignalTypes[inputPortIndex] == UnsignedInteger16Bit) {
|
||||||
ret = ::Compare<int16>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
ret = ::Compare<uint16>(comparators[inputPortIndex].comparator,
|
||||||
++intValueIndex;
|
inputSignals[inputPortIndex],
|
||||||
}
|
comparators[inputPortIndex].value.i64);
|
||||||
else if (inputSignalTypes[inputPortIndex] == UnsignedInteger8Bit) {
|
++intValueIndex;
|
||||||
ret = ::Compare<uint8>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
} else if (inputSignalTypes[inputPortIndex] == SignedInteger16Bit) {
|
||||||
++intValueIndex;
|
ret = ::Compare<int16>(comparators[inputPortIndex].comparator,
|
||||||
}
|
inputSignals[inputPortIndex],
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger8Bit) {
|
comparators[inputPortIndex].value.i64);
|
||||||
ret = ::Compare<int8>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
++intValueIndex;
|
||||||
++intValueIndex;
|
} else if (inputSignalTypes[inputPortIndex] == UnsignedInteger8Bit) {
|
||||||
}
|
ret = ::Compare<uint8>(comparators[inputPortIndex].comparator,
|
||||||
else if (inputSignalTypes[inputPortIndex] == Float64Bit) {
|
inputSignals[inputPortIndex],
|
||||||
ret = ::Compare<float64>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesFloat[floatValueIndex]);
|
comparators[inputPortIndex].value.i64);
|
||||||
++floatValueIndex;
|
++intValueIndex;
|
||||||
}
|
} else if (inputSignalTypes[inputPortIndex] == SignedInteger8Bit) {
|
||||||
else {
|
ret = ::Compare<int8>(comparators[inputPortIndex].comparator,
|
||||||
ret = ::Compare<float32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesFloat[floatValueIndex]);
|
inputSignals[inputPortIndex],
|
||||||
++floatValueIndex;
|
comparators[inputPortIndex].value.i64);
|
||||||
}
|
++intValueIndex;
|
||||||
return ret;
|
} else if (inputSignalTypes[inputPortIndex] == Float64Bit) {
|
||||||
|
ret = ::Compare<float64>(comparators[inputPortIndex].comparator,
|
||||||
|
inputSignals[inputPortIndex],
|
||||||
|
comparators[inputPortIndex].value.f64);
|
||||||
|
++floatValueIndex;
|
||||||
|
} else {
|
||||||
|
ret = ::Compare<float32>(comparators[inputPortIndex].comparator,
|
||||||
|
inputSignals[inputPortIndex],
|
||||||
|
comparators[inputPortIndex].value.f64);
|
||||||
|
++floatValueIndex;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLASS_REGISTER(JAMessageGAM, "1.0")
|
CLASS_REGISTER(JAMessageGAM, "1.0")
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
/* Project header includes */
|
/* Project header includes */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Architecture/x86_gcc/CompilerTypes.h"
|
||||||
#include "GAM.h"
|
#include "GAM.h"
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
|
|
||||||
@@ -48,22 +49,23 @@
|
|||||||
* +MessageGAM = {
|
* +MessageGAM = {
|
||||||
* Class = JAMessageGAM
|
* Class = JAMessageGAM
|
||||||
* Operation = AND // Accepted values are: AND, OR, XOR, NOR. Default value is AND.
|
* Operation = AND // Accepted values are: AND, OR, XOR, NOR. Default value is AND.
|
||||||
* ExpectedIntValues = {1 10} // Expected values for input signals of integral type.
|
|
||||||
* ExpectedFloatValues = {3.5} // Expected values for float signals of floting point type.
|
|
||||||
* Comparators = {EQUALS GREATER NOT} // Accepted values are: EQUALS, NOT, GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
|
|
||||||
* // Comparators element is optional. Default comparator is EQUALS.
|
|
||||||
* InputSignals = {
|
* InputSignals = {
|
||||||
* Sig1 = {
|
* Sig1 = {
|
||||||
* DataSource = EPICSCAInput
|
* DataSource = EPICSCAInput
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
|
* Comparator = "EQUALS" | "GREATER" | "NOT" | "EQUALS_OR_GREATER" | "LESS" | "EQUALS_OR_LESS"
|
||||||
|
* ExpectedValue = 1
|
||||||
* }
|
* }
|
||||||
* Sig2 = {
|
* Sig2 = {
|
||||||
* DataSource = EPICSCAInput
|
* DataSource = EPICSCAInput
|
||||||
* Type = float32
|
* Type = float32
|
||||||
|
* Comparator = "EQUALS" | "GREATER" | "NOT" | "EQUALS_OR_GREATER" | "LESS" | "EQUALS_OR_LESS"
|
||||||
|
* ExpectedValue = 3.5
|
||||||
* }
|
* }
|
||||||
* Sig3 = {
|
* Sig3 = {
|
||||||
* DataSource = EPICSCAInput
|
* DataSource = EPICSCAInput
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
|
* Comparator = "EQUALS" | "GREATER" | "NOT" | "EQUALS_OR_GREATER" | "LESS" | "EQUALS_OR_LESS"
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* +Event = { // Message to be sent when condition is true.
|
* +Event = { // Message to be sent when condition is true.
|
||||||
@@ -113,6 +115,17 @@ private:
|
|||||||
// Input signals
|
// Input signals
|
||||||
void **inputSignals;
|
void **inputSignals;
|
||||||
|
|
||||||
|
struct comparator_t {
|
||||||
|
ComparisonMode comparator;
|
||||||
|
union {
|
||||||
|
MARTe::int64 i64;
|
||||||
|
MARTe::float64 f64;
|
||||||
|
} value;
|
||||||
|
};
|
||||||
|
comparator_t * comparators;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MARTe::TypeDescriptor *inputSignalTypes;
|
MARTe::TypeDescriptor *inputSignalTypes;
|
||||||
|
|
||||||
// Condition operation.
|
// Condition operation.
|
||||||
@@ -123,21 +136,6 @@ private:
|
|||||||
|
|
||||||
// Was the message already sent and we are waiting for a state change before next message can be sent.
|
// Was the message already sent and we are waiting for a state change before next message can be sent.
|
||||||
bool needsReset;
|
bool needsReset;
|
||||||
|
|
||||||
// Array of expected integer values of input signals.
|
|
||||||
MARTe::uint64* expectedValuesInt;
|
|
||||||
|
|
||||||
// Array of expected float values for input signals.
|
|
||||||
MARTe::float64* expectedValuesFloat;
|
|
||||||
|
|
||||||
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
|
|
||||||
MARTe::uint32 intValuesCount;
|
|
||||||
|
|
||||||
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
|
|
||||||
MARTe::uint32 floatValuesCount;
|
|
||||||
|
|
||||||
// Array of comparators
|
|
||||||
ComparisonMode* comparators;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ OBJSX=JAMessageGAM.x
|
|||||||
|
|
||||||
PACKAGE=GAMs
|
PACKAGE=GAMs
|
||||||
|
|
||||||
ROOT_DIR=../../../../obj
|
ROOT_DIR=../../
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file JASourceChoiseGAM.cpp
|
* @file JASourceChoiceGAM.cpp
|
||||||
* @brief Source file for class JASourceChoiseGAM
|
* @brief Source file for class JASourceChoiceGAM
|
||||||
* @date Nov 26, 2018
|
* @date Nov 26, 2018
|
||||||
* @author aneto
|
* @author aneto
|
||||||
*
|
*
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* or implied. See the Licence permissions and limitations under the Licence.
|
* or implied. See the Licence permissions and limitations under the Licence.
|
||||||
|
|
||||||
* @details This source file contains the definition of all the methods for
|
* @details This source file contains the definition of all the methods for
|
||||||
* the class JASourceChoiseGAM (public, protected, and private). Be aware that some
|
* the class JASourceChoiceGAM (public, protected, and private). Be aware that some
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
* methods, such as those inline could be defined on the header file, instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
/* Project header includes */
|
/* Project header includes */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "JASourceChoiseGAM.h"
|
#include "JASourceChoiceGAM.h"
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
#include "AdvancedErrorManagement.h"
|
||||||
|
|
||||||
@@ -41,15 +41,15 @@
|
|||||||
/* Method definitions */
|
/* Method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
JASourceChoiseGAM::JASourceChoiseGAM() {
|
JASourceChoiceGAM::JASourceChoiceGAM() {
|
||||||
// initialize member variables.
|
// initialize member variables.
|
||||||
numberOfPVs = 0;
|
numberOfPVs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JASourceChoiseGAM::~JASourceChoiseGAM() {
|
JASourceChoiceGAM::~JASourceChoiceGAM() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Initialise(MARTe::StructuredDataI & data) {
|
bool JASourceChoiceGAM::Initialise(MARTe::StructuredDataI & data) {
|
||||||
//GAM parameters are initialized.
|
//GAM parameters are initialized.
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = GAM::Initialise(data);
|
bool ok = GAM::Initialise(data);
|
||||||
@@ -62,12 +62,12 @@ bool JASourceChoiseGAM::Initialise(MARTe::StructuredDataI & data) {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JASourceChoiseGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
bool JASourceChoiceGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
||||||
//This method changes internal parameter based on next realtime state.
|
//This method changes internal parameter based on next realtime state.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Setup() {
|
bool JASourceChoiceGAM::Setup() {
|
||||||
// Setup memory for input/output signals on the GAM.
|
// Setup memory for input/output signals on the GAM.
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = (numberOfInputSignals == numberOfPVs*3u);
|
bool ok = (numberOfInputSignals == numberOfPVs*3u);
|
||||||
@@ -147,7 +147,7 @@ bool JASourceChoiseGAM::Setup() {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Execute() {
|
bool JASourceChoiceGAM::Execute() {
|
||||||
// This method is called every realtime state thread cycle.
|
// This method is called every realtime state thread cycle.
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
|
||||||
@@ -185,4 +185,4 @@ bool JASourceChoiseGAM::Execute() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLASS_REGISTER(JASourceChoiseGAM, "1.0")
|
CLASS_REGISTER(JASourceChoiceGAM, "1.0")
|
||||||
@@ -38,13 +38,13 @@
|
|||||||
/* Class declaration */
|
/* Class declaration */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class JASourceChoiseGAM : public MARTe::GAM, public MARTe::StatefulI {
|
class JASourceChoiceGAM : public MARTe::GAM, public MARTe::StatefulI {
|
||||||
public:
|
public:
|
||||||
CLASS_REGISTER_DECLARATION()
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
|
||||||
JASourceChoiseGAM();
|
JASourceChoiceGAM();
|
||||||
|
|
||||||
virtual ~JASourceChoiseGAM();
|
virtual ~JASourceChoiceGAM();
|
||||||
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
virtual bool Initialise(MARTe::StructuredDataI & data);
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
OBJSX=JABitSumGAM.x
|
OBJSX=JASourceChoiceGAM.x
|
||||||
|
|
||||||
PACKAGE=GAMs
|
PACKAGE=GAMs
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
|||||||
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
all: $(OBJS) $(SUBPROJ) \
|
||||||
$(BUILD_DIR)/JABitSumGAM$(LIBEXT) \
|
$(BUILD_DIR)/JASourceChoiceGAM$(LIBEXT) \
|
||||||
$(BUILD_DIR)/JABitSumGAM$(DLLEXT)
|
$(BUILD_DIR)/JASourceChoiceGAM$(DLLEXT)
|
||||||
echo $(OBJS)
|
echo $(OBJS)
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JASourceChoiseGAM.x
|
|
||||||
|
|
||||||
PACKAGE=GAMs
|
|
||||||
|
|
||||||
ROOT_DIR=../../../../obj
|
|
||||||
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)/JASourceChoiseGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JASourceChoiseGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
||||||
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
||||||
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
||||||
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x \
|
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiceGAM.x JABitReverseGAM.x \
|
||||||
JAESDNTimeCompareGAM.x
|
JAESDNTimeCompareGAM.x
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
|
|||||||
@@ -1,366 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAEPICSCAInput.cpp
|
|
||||||
* @brief Source file for class JAEPICSCAInput
|
|
||||||
* @date 20/04/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 JAEPICSCAInput (public, protected, and private). Be aware that some
|
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "JAEPICSCAInput.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
#include "MemoryMapInputBroker.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
/**
|
|
||||||
* @brief Callback function for the ca_create_subscription. Single point of access which
|
|
||||||
* delegates the events to the corresponding JAEPICSPV instance.
|
|
||||||
*/
|
|
||||||
static FastPollingMutexSem eventCallbackFastMux;
|
|
||||||
/*lint -e{1746} function must match required prototype and thus cannot be changed to constant reference.*/
|
|
||||||
void JAEPICSCAInputEventCallback(struct event_handler_args const args) {
|
|
||||||
(void) eventCallbackFastMux.FastLock();
|
|
||||||
PVWrapper *pv = static_cast<PVWrapper *>(args.usr);
|
|
||||||
if (pv != NULL_PTR(PVWrapper *)) {
|
|
||||||
(void) MemoryOperationsHelper::Copy(pv->memory, args.dbr, pv->memorySize);
|
|
||||||
}
|
|
||||||
eventCallbackFastMux.FastUnLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
namespace MARTe {
|
|
||||||
JAEPICSCAInput::JAEPICSCAInput() :
|
|
||||||
DataSourceI(), EmbeddedServiceMethodBinderI(), executor(*this) {
|
|
||||||
pvs = NULL_PTR(PVWrapper *);
|
|
||||||
stackSize = THREADS_DEFAULT_STACKSIZE * 4u;
|
|
||||||
cpuMask = 0xffu;
|
|
||||||
eventCallbackFastMux.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{1551} must stop the SingleThreadService in the destructor.*/
|
|
||||||
JAEPICSCAInput::~JAEPICSCAInput() {
|
|
||||||
if (!executor.Stop()) {
|
|
||||||
if (!executor.Stop()) {
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Could not stop SingleThreadService.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) eventCallbackFastMux.FastLock();
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
uint32 n;
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
if (pvs[n].memory != NULL_PTR(void *)) {
|
|
||||||
GlobalObjectsDatabase::Instance()->GetStandardHeap()->Free(pvs[n].memory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] pvs;
|
|
||||||
}
|
|
||||||
eventCallbackFastMux.FastUnLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAInput::Initialise(StructuredDataI & data) {
|
|
||||||
bool ok = DataSourceI::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
if (!data.Read("CPUs", cpuMask)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "No CPUs defined. Using default = %d", cpuMask);
|
|
||||||
}
|
|
||||||
if (!data.Read("StackSize", stackSize)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "No StackSize defined. Using default = %d", stackSize);
|
|
||||||
}
|
|
||||||
executor.SetStackSize(stackSize);
|
|
||||||
executor.SetCPUMask(cpuMask);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.MoveRelative("Signals");
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Could not move to the Signals section");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Copy(originalSignalInformation);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = originalSignalInformation.MoveToRoot();
|
|
||||||
}
|
|
||||||
//Do not allow to add signals in run-time
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.MoveRelative("Signals");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.Write("Locked", 1u);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAInput::SetConfiguredDatabase(StructuredDataI & data) {
|
|
||||||
bool ok = DataSourceI::SetConfiguredDatabase(data);
|
|
||||||
//Check the signal index of the timing signal.
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (ok) {
|
|
||||||
ok = (nOfSignals > 0u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
//Do not allow samples
|
|
||||||
uint32 functionNumberOfSignals = 0u;
|
|
||||||
uint32 n;
|
|
||||||
if (GetFunctionNumberOfSignals(InputSignals, 0u, functionNumberOfSignals)) {
|
|
||||||
for (n = 0u; (n < functionNumberOfSignals) && (ok); n++) {
|
|
||||||
uint32 nSamples;
|
|
||||||
ok = GetFunctionSignalSamples(InputSignals, 0u, n, nSamples);
|
|
||||||
if (ok) {
|
|
||||||
ok = (nSamples == 1u);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The number of samples shall be exactly 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
pvs = new PVWrapper[nOfSignals];
|
|
||||||
uint32 n;
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
pvs[n].memory = NULL_PTR(void *);
|
|
||||||
}
|
|
||||||
for (n = 0u; (n < nOfSignals) && (ok); n++) {
|
|
||||||
//Note that the RealTimeApplicationConfigurationBuilder is allowed to change the order of the signals w.r.t. to the originalSignalInformation
|
|
||||||
StreamString orderedSignalName;
|
|
||||||
ok = GetSignalName(n, orderedSignalName);
|
|
||||||
if (ok) {
|
|
||||||
//Have to mix and match between the original setting of the DataSource signal
|
|
||||||
//and the ones which are later added by the RealTimeApplicationConfigurationBuilder
|
|
||||||
ok = originalSignalInformation.MoveRelative(orderedSignalName.Buffer());
|
|
||||||
}
|
|
||||||
StreamString pvName;
|
|
||||||
if (ok) {
|
|
||||||
ok = originalSignalInformation.Read("PVName", pvName);
|
|
||||||
if (!ok) {
|
|
||||||
uint32 nn = n;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "No PVName specified for signal at index %d", nn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TypeDescriptor td = GetSignalType(n);
|
|
||||||
if (ok) {
|
|
||||||
(void) StringHelper::CopyN(&pvs[n].pvName[0], pvName.Buffer(), PV_NAME_MAX_SIZE);
|
|
||||||
if (td == CharString) {
|
|
||||||
pvs[n].pvType = DBR_STRING;
|
|
||||||
}
|
|
||||||
else if (td == Character8Bit) {
|
|
||||||
pvs[n].pvType = DBR_STRING;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger8Bit) {
|
|
||||||
pvs[n].pvType = DBR_CHAR;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger8Bit) {
|
|
||||||
pvs[n].pvType = DBR_CHAR;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger16Bit) {
|
|
||||||
pvs[n].pvType = DBR_SHORT;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger16Bit) {
|
|
||||||
pvs[n].pvType = DBR_SHORT;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger32Bit) {
|
|
||||||
pvs[n].pvType = DBR_LONG;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger32Bit) {
|
|
||||||
pvs[n].pvType = DBR_LONG;
|
|
||||||
}
|
|
||||||
else if (td == Float32Bit) {
|
|
||||||
pvs[n].pvType = DBR_FLOAT;
|
|
||||||
}
|
|
||||||
else if (td == Float64Bit) {
|
|
||||||
pvs[n].pvType = DBR_DOUBLE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Type %s is not supported", TypeDescriptor::GetTypeNameFromTypeDescriptor(td));
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uint32 numberOfElements = 1u;
|
|
||||||
if (ok) {
|
|
||||||
ok = GetSignalNumberOfElements(n, numberOfElements);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
if (pvs[n].pvType == DBR_STRING) {
|
|
||||||
ok = (numberOfElements == 40u);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
//Could support arrays of strings with multiples of char8[40]
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Strings shall be defined with 40 elements char8[40]. Arrays of strings are not currently supported");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
pvs[n].numberOfElements = numberOfElements;
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
pvs[n].memorySize = td.numberOfBits;
|
|
||||||
pvs[n].memorySize /= 8u;
|
|
||||||
pvs[n].memorySize *= numberOfElements;
|
|
||||||
pvs[n].memory = GlobalObjectsDatabase::Instance()->GetStandardHeap()->Malloc(pvs[n].memorySize);
|
|
||||||
ok = originalSignalInformation.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
ok = (executor.Start() == ErrorManagement::NoError);
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAInput::AllocateMemory() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAInput::GetNumberOfMemoryBuffers() {
|
|
||||||
return 1u;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: The signalAddress is independent of the bufferIdx.*/
|
|
||||||
bool JAEPICSCAInput::GetSignalMemoryBuffer(const uint32 signalIdx, const uint32 bufferIdx, void*& signalAddress) {
|
|
||||||
bool ok = (pvs != NULL_PTR(PVWrapper *));
|
|
||||||
if (ok) {
|
|
||||||
ok = (signalIdx < GetNumberOfSignals());
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
//lint -e{613} pvs cannot as otherwise ok would be false
|
|
||||||
signalAddress = pvs[signalIdx].memory;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: The brokerName only depends on the direction */
|
|
||||||
const char8* JAEPICSCAInput::GetBrokerName(StructuredDataI& data, const SignalDirection direction) {
|
|
||||||
const char8* brokerName = "";
|
|
||||||
if (direction == InputSignals) {
|
|
||||||
brokerName = "MemoryMapInputBroker";
|
|
||||||
}
|
|
||||||
return brokerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAInput::GetInputBrokers(ReferenceContainer& inputBrokers, const char8* const functionName, void* const gamMemPtr) {
|
|
||||||
ReferenceT<MemoryMapInputBroker> broker("MemoryMapInputBroker");
|
|
||||||
bool ok = broker->Init(InputSignals, *this, functionName, gamMemPtr);
|
|
||||||
if (ok) {
|
|
||||||
ok = inputBrokers.Insert(broker);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: OutputBrokers are not supported. Function returns false irrespectively of the parameters.*/
|
|
||||||
bool JAEPICSCAInput::GetOutputBrokers(ReferenceContainer& outputBrokers, const char8* const functionName, void* const gamMemPtr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: NOOP at StateChange, independently of the function parameters.*/
|
|
||||||
bool JAEPICSCAInput::PrepareNextState(const char8* const currentStateName, const char8* const nextStateName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorManagement::ErrorType JAEPICSCAInput::Execute(ExecutionInfo& info) {
|
|
||||||
ErrorManagement::ErrorType err = ErrorManagement::NoError;
|
|
||||||
if (info.GetStage() == ExecutionInfo::StartupStage) {
|
|
||||||
(void) eventCallbackFastMux.FastLock();
|
|
||||||
/*lint -e{9130} -e{835} -e{845} -e{747} Several false positives. lint is getting confused here for some reason.*/
|
|
||||||
if (ca_context_create(ca_enable_preemptive_callback) != ECA_NORMAL) {
|
|
||||||
err = ErrorManagement::FatalError;
|
|
||||||
REPORT_ERROR(err, "ca_enable_preemptive_callback failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 n;
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
/*lint -e{9130} -e{835} -e{845} -e{747} Several false positives. lint is getting confused here for some reason.*/
|
|
||||||
if (ca_create_channel(&pvs[n].pvName[0], NULL_PTR(caCh *), NULL_PTR(void *), 20u, &pvs[n].pvChid) != ECA_NORMAL) {
|
|
||||||
err = ErrorManagement::FatalError;
|
|
||||||
REPORT_ERROR(err, "ca_create_channel failed for PV with name %s", pvs[n].pvName);
|
|
||||||
}
|
|
||||||
if (err.ErrorsCleared()) {
|
|
||||||
/*lint -e{9130} -e{835} -e{845} -e{747} Several false positives. lint is getting confused here for some reason.*/
|
|
||||||
if (ca_create_subscription(pvs[n].pvType, pvs[n].numberOfElements, pvs[n].pvChid, DBE_VALUE, &JAEPICSCAInputEventCallback, &pvs[n],
|
|
||||||
&pvs[n].pvEvid) != ECA_NORMAL) {
|
|
||||||
err = ErrorManagement::FatalError;
|
|
||||||
REPORT_ERROR(err, "ca_create_subscription failed for PV %s", pvs[n].pvName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
eventCallbackFastMux.FastUnLock();
|
|
||||||
}
|
|
||||||
else if (info.GetStage() != ExecutionInfo::BadTerminationStage) {
|
|
||||||
Sleep::Sec(1.0F);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(void) eventCallbackFastMux.FastLock();
|
|
||||||
uint32 n;
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
(void) ca_clear_subscription(pvs[n].pvEvid);
|
|
||||||
(void) ca_clear_event(pvs[n].pvEvid);
|
|
||||||
(void) ca_clear_channel(pvs[n].pvChid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ca_detach_context();
|
|
||||||
ca_context_destroy();
|
|
||||||
eventCallbackFastMux.FastUnLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAInput::GetStackSize() const {
|
|
||||||
return stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAInput::GetCPUMask() const {
|
|
||||||
return cpuMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAInput::Synchronise() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAEPICSCAInput, "1.0")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file EPICSCAInput.h
|
|
||||||
* @brief Header file for class EPICSCAInput
|
|
||||||
* @date 20/04/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 EPICSCAInput
|
|
||||||
* 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 JAEPICSCAINPUT_H_
|
|
||||||
#define JAEPICSCAINPUT_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <cadef.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
#include "EmbeddedServiceMethodBinderI.h"
|
|
||||||
#include "EventSem.h"
|
|
||||||
#include "SingleThreadService.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
namespace MARTe {
|
|
||||||
/**
|
|
||||||
* Maximum size that a PV name may have
|
|
||||||
*/
|
|
||||||
/*lint -esym(551, MARTe::PV_NAME_MAX_SIZE) the symbol is used to define the size of PVWrapper below*/
|
|
||||||
const uint32 PV_NAME_MAX_SIZE = 64u;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps a PV
|
|
||||||
*/
|
|
||||||
struct PVWrapper {
|
|
||||||
/**
|
|
||||||
* The channel identifier
|
|
||||||
*/
|
|
||||||
chid pvChid;
|
|
||||||
/**
|
|
||||||
* The event identifier
|
|
||||||
*/
|
|
||||||
evid pvEvid;
|
|
||||||
/**
|
|
||||||
* The PV type
|
|
||||||
*/
|
|
||||||
chtype pvType;
|
|
||||||
/**
|
|
||||||
* The memory of the signal associated to this channel
|
|
||||||
*/
|
|
||||||
void *memory;
|
|
||||||
void *previousValue;
|
|
||||||
/**
|
|
||||||
* The number of elements > 0
|
|
||||||
*/
|
|
||||||
uint32 numberOfElements;
|
|
||||||
/**
|
|
||||||
* The memory size
|
|
||||||
*/
|
|
||||||
uint32 memorySize;
|
|
||||||
/**
|
|
||||||
* The PV name
|
|
||||||
*/
|
|
||||||
char8 pvName[PV_NAME_MAX_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A DataSource which allows to retrieved data from any number of PVs using the EPICS channel access client protocol.
|
|
||||||
* Data is asynchronously retrieved using ca_create_subscriptions in the context of a different thread (w.r.t. to the real-time thread).
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names are only given as an example):
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* +EPICSCAInput_1 = {
|
|
||||||
* Class = JAEPICSCA::JAEPICSCAInput
|
|
||||||
* StackSize = 1048576 //Optional the EmbeddedThread stack size. Default value is THREADS_DEFAULT_STACKSIZE * 4u
|
|
||||||
* CPUs = 0xff //Optional the affinity of the EmbeddedThread (where the EPICS context is attached).
|
|
||||||
* Signals = {
|
|
||||||
* PV1 = { //At least one shall be defined
|
|
||||||
* PVName = My::PV1 //Compulsory. Name of the PV.
|
|
||||||
* Type = uint32 //Compulsory. Supported types are char8[40], string[40], uint8, int8, uint16, int16, int32, uint32, uint64, int64, float32 and float64
|
|
||||||
* NumberOfElements = 1 //Arrays also supported
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
class JAEPICSCAInput: public DataSourceI, public EmbeddedServiceMethodBinderI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Default constructor. NOOP.
|
|
||||||
*/
|
|
||||||
JAEPICSCAInput();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor.
|
|
||||||
* @details TODO.
|
|
||||||
*/
|
|
||||||
virtual ~JAEPICSCAInput();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::AllocateMemory. NOOP.
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool AllocateMemory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetNumberOfMemoryBuffers.
|
|
||||||
* @return 1.
|
|
||||||
*/
|
|
||||||
virtual uint32 GetNumberOfMemoryBuffers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetSignalMemoryBuffer.
|
|
||||||
* @pre
|
|
||||||
* SetConfiguredDatabase
|
|
||||||
*/
|
|
||||||
virtual bool GetSignalMemoryBuffer(const uint32 signalIdx,
|
|
||||||
const uint32 bufferIdx,
|
|
||||||
void *&signalAddress);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetNumberOfMemoryBuffers.
|
|
||||||
* @details Only InputSignals are supported.
|
|
||||||
* @return MemoryMapInputBroker.
|
|
||||||
*/
|
|
||||||
virtual const char8 *GetBrokerName(StructuredDataI &data,
|
|
||||||
const SignalDirection direction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetInputBrokers.
|
|
||||||
* @details adds a memory MemoryMapInputBroker instance to the inputBrokers
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool GetInputBrokers(ReferenceContainer &inputBrokers,
|
|
||||||
const char8* const functionName,
|
|
||||||
void * const gamMemPtr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetOutputBrokers.
|
|
||||||
* @return false.
|
|
||||||
*/
|
|
||||||
virtual bool GetOutputBrokers(ReferenceContainer &outputBrokers,
|
|
||||||
const char8* const functionName,
|
|
||||||
void * const gamMemPtr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::PrepareNextState. NOOP.
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool PrepareNextState(const char8 * const currentStateName,
|
|
||||||
const char8 * const nextStateName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Loads and verifies the configuration parameters detailed in the class description.
|
|
||||||
* @return true if all the mandatory parameters are correctly specified and if the specified optional parameters have valid values.
|
|
||||||
*/
|
|
||||||
virtual bool Initialise(StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Final verification of all the parameters. Setup of the memory required to hold all the signals.
|
|
||||||
* @details This method verifies that all the parameters requested by the GAMs interacting with this DataSource
|
|
||||||
* are valid and consistent with the parameters set during the initialisation phase.
|
|
||||||
* In particular the following conditions shall be met:
|
|
||||||
* - All the signals have the PVName defined
|
|
||||||
* - All the signals have one of the following types: uint32, int32, float32 or float64.
|
|
||||||
* @return true if all the parameters are valid and the conditions above are met.
|
|
||||||
*/
|
|
||||||
virtual bool SetConfiguredDatabase(StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the affinity of the thread which is going to be used to asynchronously read data from the ca_create_subscription.
|
|
||||||
* @return the the affinity of the thread which is going to be used to asynchronously read data from the ca_create_subscription.
|
|
||||||
*/
|
|
||||||
uint32 GetCPUMask() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the stack size of the thread which is going to be used to asynchronously read data from the ca_create_subscription.
|
|
||||||
* @return the stack size of the thread which is going to be used to asynchronously read data from the ca_create_subscription.
|
|
||||||
*/
|
|
||||||
uint32 GetStackSize() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Provides the context to execute all the EPICS relevant calls.
|
|
||||||
* @details Executes in the context of a spawned thread the following EPICS calls:
|
|
||||||
* ca_context_create, ca_create_channel, ca_create_subscription, ca_clear_subscription,
|
|
||||||
* ca_clear_event, ca_clear_channel, ca_detach_context and ca_context_destroy
|
|
||||||
* @return ErrorManagement::NoError if all the EPICS calls return without any error.
|
|
||||||
*/
|
|
||||||
virtual ErrorManagement::ErrorType Execute(ExecutionInfo & info);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::Synchronise.
|
|
||||||
* @return false.
|
|
||||||
*/
|
|
||||||
virtual bool Synchronise();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Registered as the ca_create_subscription callback function.
|
|
||||||
* It calls updates the memory of the corresponding PV variable.
|
|
||||||
*/
|
|
||||||
friend void JAEPICSCAInputEventCallback(struct event_handler_args args);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of PVs.
|
|
||||||
*/
|
|
||||||
PVWrapper *pvs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CPU mask for the executor
|
|
||||||
*/
|
|
||||||
uint32 cpuMask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stack size
|
|
||||||
*/
|
|
||||||
uint32 stackSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The EmbeddedThread where the ca_pend_event is executed.
|
|
||||||
*/
|
|
||||||
SingleThreadService executor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the configuration information received at Initialise.
|
|
||||||
*/
|
|
||||||
ConfigurationDatabase originalSignalInformation;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* EPICSCADATASOURCE_H_ */
|
|
||||||
|
|
||||||
@@ -1,375 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file EPICSCAOutput.cpp
|
|
||||||
* @brief Source file for class EPICSCAOutput
|
|
||||||
* @date 20/04/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 EPICSCAOutput (public, protected, and private). Be aware that some
|
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "JAEPICSCAOutput.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
#include "MemoryMapAsyncOutputBroker.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
namespace MARTe {
|
|
||||||
JAEPICSCAOutput::JAEPICSCAOutput() :
|
|
||||||
DataSourceI() {
|
|
||||||
pvs = NULL_PTR(PVWrapper *);
|
|
||||||
stackSize = THREADS_DEFAULT_STACKSIZE * 4u;
|
|
||||||
cpuMask = 0xffu;
|
|
||||||
numberOfBuffers = 0u;
|
|
||||||
ignoreBufferOverrun = 1u;
|
|
||||||
threadContextSet = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{1551} must free the memory allocated to the different PVs.*/
|
|
||||||
JAEPICSCAOutput::~JAEPICSCAOutput() {
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
uint32 n;
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
if (pvs[n].pvChid != NULL_PTR(chid)) {
|
|
||||||
(void) ca_clear_channel(pvs[n].pvChid);
|
|
||||||
}
|
|
||||||
if (pvs[n].memory != NULL_PTR(void *)) {
|
|
||||||
GlobalObjectsDatabase::Instance()->GetStandardHeap()->Free(pvs[n].memory);
|
|
||||||
GlobalObjectsDatabase::Instance()->GetStandardHeap()->Free(pvs[n].previousValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] pvs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::Initialise(StructuredDataI & data) {
|
|
||||||
bool ok = DataSourceI::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("NumberOfBuffers", numberOfBuffers);
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "NumberOfBuffers shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
if (!data.Read("CPUs", cpuMask)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "No CPUs defined. Using default = %d", cpuMask);
|
|
||||||
}
|
|
||||||
if (!data.Read("StackSize", stackSize)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "No StackSize defined. Using default = %d", stackSize);
|
|
||||||
}
|
|
||||||
if (!data.Read("IgnoreBufferOverrun", ignoreBufferOverrun)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "No IgnoreBufferOverrun defined. Using default = %d", ignoreBufferOverrun);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.MoveRelative("Signals");
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Could not move to the Signals section");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Copy(originalSignalInformation);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = originalSignalInformation.MoveToRoot();
|
|
||||||
}
|
|
||||||
//Do not allow to add signals in run-time
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.MoveRelative("Signals");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.Write("Locked", 1u);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = signalsDatabase.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::SetConfiguredDatabase(StructuredDataI & data) {
|
|
||||||
bool ok = DataSourceI::SetConfiguredDatabase(data);
|
|
||||||
//Check the signal index of the timing signal.
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (ok) {
|
|
||||||
ok = (nOfSignals > 0u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
//Do not allow samples
|
|
||||||
uint32 functionNumberOfSignals = 0u;
|
|
||||||
uint32 n;
|
|
||||||
if (GetFunctionNumberOfSignals(OutputSignals, 0u, functionNumberOfSignals)) {
|
|
||||||
for (n = 0u; (n < functionNumberOfSignals) && (ok); n++) {
|
|
||||||
uint32 nSamples;
|
|
||||||
ok = GetFunctionSignalSamples(OutputSignals, 0u, n, nSamples);
|
|
||||||
if (ok) {
|
|
||||||
ok = (nSamples == 1u);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The number of samples shall be exactly 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Only one and one GAM allowed to interact with this DataSourceI
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetNumberOfFunctions() == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Exactly one Function allowed to interact with this DataSourceI");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
pvs = new PVWrapper[nOfSignals];
|
|
||||||
uint32 n;
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
pvs[n].memory = NULL_PTR(void *); //value to write PV
|
|
||||||
pvs[n].previousValue = NULL_PTR(void *); //written value
|
|
||||||
pvs[n].pvChid = NULL_PTR(chid);
|
|
||||||
|
|
||||||
}
|
|
||||||
for (n = 0u; (n < nOfSignals) && (ok); n++) {
|
|
||||||
//Note that the RealTimeApplicationConfigurationBuilder is allowed to change the order of the signals w.r.t. to the originalSignalInformation
|
|
||||||
StreamString orderedSignalName;
|
|
||||||
ok = GetSignalName(n, orderedSignalName);
|
|
||||||
if (ok) {
|
|
||||||
//Have to mix and match between the original setting of the DataSource signal
|
|
||||||
//and the ones which are later added by the RealTimeApplicationConfigurationBuilder
|
|
||||||
ok = originalSignalInformation.MoveRelative(orderedSignalName.Buffer());
|
|
||||||
}
|
|
||||||
StreamString pvName;
|
|
||||||
if (ok) {
|
|
||||||
ok = originalSignalInformation.Read("PVName", pvName);
|
|
||||||
if (!ok) {
|
|
||||||
uint32 nn = n;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "No PVName specified for signal at index %d", nn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TypeDescriptor td = GetSignalType(n);
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
(void) StringHelper::CopyN(&pvs[n].pvName[0], pvName.Buffer(), PV_NAME_MAX_SIZE);
|
|
||||||
if (td == CharString) {
|
|
||||||
pvs[n].pvType = DBR_STRING;
|
|
||||||
}
|
|
||||||
else if (td == Character8Bit) {
|
|
||||||
pvs[n].pvType = DBR_STRING;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger8Bit) {
|
|
||||||
pvs[n].pvType = DBR_CHAR;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger8Bit) {
|
|
||||||
pvs[n].pvType = DBR_CHAR;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger16Bit) {
|
|
||||||
pvs[n].pvType = DBR_SHORT;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger16Bit) {
|
|
||||||
pvs[n].pvType = DBR_SHORT;
|
|
||||||
}
|
|
||||||
else if (td == SignedInteger32Bit) {
|
|
||||||
pvs[n].pvType = DBR_LONG;
|
|
||||||
}
|
|
||||||
else if (td == UnsignedInteger32Bit) {
|
|
||||||
pvs[n].pvType = DBR_LONG;
|
|
||||||
}
|
|
||||||
else if (td == Float32Bit) {
|
|
||||||
pvs[n].pvType = DBR_FLOAT;
|
|
||||||
}
|
|
||||||
else if (td == Float64Bit) {
|
|
||||||
pvs[n].pvType = DBR_DOUBLE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Type %s is not supported", TypeDescriptor::GetTypeNameFromTypeDescriptor(td));
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uint32 numberOfElements = 1u;
|
|
||||||
if (ok) {
|
|
||||||
ok = GetSignalNumberOfElements(n, numberOfElements);
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
if (pvs[n].pvType == DBR_STRING) {
|
|
||||||
ok = (numberOfElements == 40u);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
//Could support arrays of strings with multiples of char8[40]
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError,
|
|
||||||
"Strings shall be defined with 40 elements char8[40]. Arrays of strings are not currently supported");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
pvs[n].numberOfElements = numberOfElements;
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
pvs[n].memorySize = td.numberOfBits;
|
|
||||||
pvs[n].memorySize /= 8u;
|
|
||||||
pvs[n].memorySize *= numberOfElements;
|
|
||||||
pvs[n].memory = GlobalObjectsDatabase::Instance()->GetStandardHeap()->Malloc(pvs[n].memorySize);
|
|
||||||
pvs[n].previousValue = GlobalObjectsDatabase::Instance()->GetStandardHeap()->Malloc(pvs[n].memorySize);
|
|
||||||
ok = originalSignalInformation.MoveToAncestor(1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::AllocateMemory() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAOutput::GetNumberOfMemoryBuffers() {
|
|
||||||
return 1u;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: The signalAddress is independent of the bufferIdx.*/
|
|
||||||
bool JAEPICSCAOutput::GetSignalMemoryBuffer(const uint32 signalIdx, const uint32 bufferIdx, void*& signalAddress) {
|
|
||||||
bool ok = (pvs != NULL_PTR(PVWrapper *));
|
|
||||||
if (ok) {
|
|
||||||
ok = (signalIdx < GetNumberOfSignals());
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
//lint -e{613} pvs cannot as otherwise ok would be false
|
|
||||||
signalAddress = pvs[signalIdx].memory;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: The brokerName only depends on the direction */
|
|
||||||
const char8* JAEPICSCAOutput::GetBrokerName(StructuredDataI& data, const SignalDirection direction) {
|
|
||||||
const char8* brokerName = "";
|
|
||||||
if (direction == OutputSignals) {
|
|
||||||
brokerName = "MemoryMapAsyncOutputBroker";
|
|
||||||
}
|
|
||||||
return brokerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: InputBrokers are not supported. Function returns false irrespectively of the parameters.*/
|
|
||||||
bool JAEPICSCAOutput::GetInputBrokers(ReferenceContainer& inputBrokers, const char8* const functionName, void* const gamMemPtr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::GetOutputBrokers(ReferenceContainer& outputBrokers, const char8* const functionName, void* const gamMemPtr) {
|
|
||||||
ReferenceT<MemoryMapAsyncOutputBroker> broker("MemoryMapAsyncOutputBroker");
|
|
||||||
bool ok = broker->InitWithBufferParameters(OutputSignals, *this, functionName, gamMemPtr, numberOfBuffers, cpuMask, stackSize);
|
|
||||||
if (ok) {
|
|
||||||
ok = outputBrokers.Insert(broker);
|
|
||||||
broker->SetIgnoreBufferOverrun(ignoreBufferOverrun == 1u);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*lint -e{715} [MISRA C++ Rule 0-1-11], [MISRA C++ Rule 0-1-12]. Justification: NOOP at StateChange, independently of the function parameters.*/
|
|
||||||
bool JAEPICSCAOutput::PrepareNextState(const char8* const currentStateName, const char8* const nextStateName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAOutput::GetStackSize() const {
|
|
||||||
return stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAOutput::GetCPUMask() const {
|
|
||||||
return cpuMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 JAEPICSCAOutput::GetNumberOfBuffers() const {
|
|
||||||
return numberOfBuffers;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::Synchronise() {
|
|
||||||
bool ok = true;
|
|
||||||
uint32 n;
|
|
||||||
uint32 nOfSignals = GetNumberOfSignals();
|
|
||||||
if (!threadContextSet) {
|
|
||||||
ok = (ca_context_create(ca_enable_preemptive_callback) == ECA_NORMAL);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "ca_enable_preemptive_callback failed");
|
|
||||||
}
|
|
||||||
threadContextSet = ok;
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
ok = (ca_create_channel(&pvs[n].pvName[0], NULL_PTR(caCh *), NULL_PTR(void *), 20u, &pvs[n].pvChid) == ECA_NORMAL);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "ca_create_channel failed for PV with name %s", pvs[n].pvName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Allow to write event at the first time!
|
|
||||||
if (threadContextSet) {
|
|
||||||
if (pvs != NULL_PTR(PVWrapper *)) {
|
|
||||||
for (n = 0u; (n < nOfSignals); n++) {
|
|
||||||
bool isNewValue = true;
|
|
||||||
if (pvs[n].pvType == DBR_STRING) {
|
|
||||||
if(strcmp((char*)pvs[n].memory,(char*)pvs[n].previousValue)==0){
|
|
||||||
isNewValue = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(isNewValue){
|
|
||||||
ok = (ca_put(pvs[n].pvType, pvs[n].pvChid, pvs[n].memory) == ECA_NORMAL);
|
|
||||||
memcpy(pvs[n].previousValue,pvs[n].memory, pvs[n].numberOfElements);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(memcmp(pvs[n].memory, pvs[n].previousValue, pvs[n].numberOfElements)==0){
|
|
||||||
isNewValue = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(isNewValue){
|
|
||||||
ok = (ca_array_put(pvs[n].pvType, pvs[n].numberOfElements, pvs[n].pvChid, pvs[n].memory) == ECA_NORMAL);
|
|
||||||
memcpy(pvs[n].previousValue, pvs[n].memory, pvs[n].numberOfElements);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "ca_put failed for PV: %s", pvs[n].pvName);
|
|
||||||
}
|
|
||||||
(void) ca_pend_io(0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAEPICSCAOutput::IsIgnoringBufferOverrun() const {
|
|
||||||
return (ignoreBufferOverrun == 1u);
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAEPICSCAOutput, "1.0")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file EPICSCAOutput.h
|
|
||||||
* @brief Header file for class EPICSCAOutput
|
|
||||||
* @date 20/04/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 EPICSCAOutput
|
|
||||||
* 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 JAEPICSCAOutput_H_
|
|
||||||
#define JAEPICSCAOutput_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <cadef.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
#include "JAEPICSCAInput.h"
|
|
||||||
#include "EmbeddedServiceMethodBinderI.h"
|
|
||||||
#include "EventSem.h"
|
|
||||||
#include "SingleThreadService.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
namespace MARTe {
|
|
||||||
//Maximum size that a PV name may have
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A DataSource which allows to output data into any number of PVs using the EPICS channel access client protocol.
|
|
||||||
* Data is asynchronously ca_put in the context of a different thread (w.r.t. to the real-time thread).
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names are only given as an example):
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* +EPICSCAOutput_1 = {
|
|
||||||
* Class = EPICSCA::EPICSCAOutput
|
|
||||||
* StackSize = 1048576 //Optional the EmbeddedThread stack size. Default value is THREADS_DEFAULT_STACKSIZE * 4u
|
|
||||||
* CPUs = 0xff //Optional the affinity of the EmbeddedThread (where the EPICS context is attached).
|
|
||||||
* IgnoreBufferOverrun = 1 //Optional. If true no error will be triggered when the thread that writes into EPICS does not consume the data fast enough.
|
|
||||||
* NumberOfBuffers = 10 //Compulsory. Number of buffers in a circular buffer that asynchronously writes the PV values. Each buffer is capable of holding a copy of all the DataSourceI signals.
|
|
||||||
* Signals = {
|
|
||||||
* PV1 = { //At least one shall be defined
|
|
||||||
* PVName = My::PV1 //Compulsory. Name of the PV.
|
|
||||||
* Type = uint32 //Compulsory. Supported types are char8[40], string[40], uint8, int8, uint16, int16, int32, uint32, float32 and float64
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
class JAEPICSCAOutput: public DataSourceI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Default constructor. NOOP.
|
|
||||||
*/
|
|
||||||
JAEPICSCAOutput();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor.
|
|
||||||
* @details TODO.
|
|
||||||
*/
|
|
||||||
virtual ~JAEPICSCAOutput();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::AllocateMemory. NOOP.
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool AllocateMemory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetNumberOfMemoryBuffers.
|
|
||||||
* @return 1.
|
|
||||||
*/
|
|
||||||
virtual uint32 GetNumberOfMemoryBuffers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetSignalMemoryBuffer.
|
|
||||||
* @pre
|
|
||||||
* SetConfiguredDatabase
|
|
||||||
*/
|
|
||||||
virtual bool GetSignalMemoryBuffer(const uint32 signalIdx,
|
|
||||||
const uint32 bufferIdx,
|
|
||||||
void *&signalAddress);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetNumberOfMemoryBuffers.
|
|
||||||
* @details Only OutputSignals are supported.
|
|
||||||
* @return MemoryMapAsyncOutputBroker.
|
|
||||||
*/
|
|
||||||
virtual const char8 *GetBrokerName(StructuredDataI &data,
|
|
||||||
const SignalDirection direction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetInputBrokers.
|
|
||||||
* @return false.
|
|
||||||
*/
|
|
||||||
virtual bool GetInputBrokers(ReferenceContainer &inputBrokers,
|
|
||||||
const char8* const functionName,
|
|
||||||
void * const gamMemPtr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::GetOutputBrokers.
|
|
||||||
* @details adds a memory MemoryMapOutputBroker instance to the outputBrokers
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool GetOutputBrokers(ReferenceContainer &outputBrokers,
|
|
||||||
const char8* const functionName,
|
|
||||||
void * const gamMemPtr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief See DataSourceI::PrepareNextState. NOOP.
|
|
||||||
* @return true.
|
|
||||||
*/
|
|
||||||
virtual bool PrepareNextState(const char8 * const currentStateName,
|
|
||||||
const char8 * const nextStateName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Loads and verifies the configuration parameters detailed in the class description.
|
|
||||||
* @return true if all the mandatory parameters are correctly specified and if the specified optional parameters have valid values.
|
|
||||||
*/
|
|
||||||
virtual bool Initialise(StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Final verification of all the parameters. Setup of the memory required to hold all the signals.
|
|
||||||
* @details This method verifies that all the parameters requested by the GAMs interacting with this DataSource
|
|
||||||
* are valid and consistent with the parameters set during the initialisation phase.
|
|
||||||
* In particular the following conditions shall be met:
|
|
||||||
* - All the signals have the PVName defined
|
|
||||||
* - All the signals have one of the following types: uint32, int32, float32 or float64.
|
|
||||||
* @return true if all the parameters are valid and the conditions above are met.
|
|
||||||
*/
|
|
||||||
virtual bool SetConfiguredDatabase(StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the affinity of the thread which is going to be used to asynchronously write data with ca_put.
|
|
||||||
* @return the affinity of the thread which is going to be used to asynchronously write data with ca_put.
|
|
||||||
*/
|
|
||||||
uint32 GetCPUMask() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the stack size of the thread which is going to be used to asynchronously write data with ca_put.
|
|
||||||
* @return the stack size of the thread which is going to be used to asynchronously write data with ca_put.
|
|
||||||
*/
|
|
||||||
uint32 GetStackSize() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the number of buffers in the circular buffer that asynchronously writes the PV values.
|
|
||||||
* @return the number of buffers in the circular buffer that asynchronously writes the PV values.
|
|
||||||
*/
|
|
||||||
uint32 GetNumberOfBuffers() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Provides the context to execute all the EPICS ca_put calls.
|
|
||||||
* @details Executes in the context of the MemoryMapAsyncOutputBroker thread the following EPICS calls:
|
|
||||||
* ca_context_create, ca_create_channel, ca_create_subscription, ca_clear_subscription,
|
|
||||||
* ca_clear_event, ca_clear_channel, ca_detach_context and ca_context_destroy
|
|
||||||
* @return true if all the EPICS calls return without any error.
|
|
||||||
*/
|
|
||||||
virtual bool Synchronise();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets if buffer overruns is being ignored (i.e. the consumer thread which writes into EPICS is not consuming the data fast enough).
|
|
||||||
* @return if true no error is to be triggered when there is a buffer overrun.
|
|
||||||
*/
|
|
||||||
bool IsIgnoringBufferOverrun() const;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* List of PVs.
|
|
||||||
*/
|
|
||||||
PVWrapper *pvs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CPU mask for the executor
|
|
||||||
*/
|
|
||||||
uint32 cpuMask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stack size
|
|
||||||
*/
|
|
||||||
uint32 stackSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the configuration information received at Initialise.
|
|
||||||
*/
|
|
||||||
ConfigurationDatabase originalSignalInformation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of buffers for the circular buffer that flushes data into EPICS
|
|
||||||
*/
|
|
||||||
uint32 numberOfBuffers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True once the epics thread context is set
|
|
||||||
*/
|
|
||||||
bool threadContextSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If true no error will be triggered when the data cannot be consumed by the thread doing the caputs.
|
|
||||||
*/
|
|
||||||
uint32 ignoreBufferOverrun;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* EPICSCADATASOURCE_H_ */
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
LIBRARIES += -L$(EPICS_BASE)/lib/$(EPICS_HOST_ARCH)/ -lca
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAEPICSCAOutput.x JAEPICSCAInput.x
|
|
||||||
|
|
||||||
PACKAGE=DataSources
|
|
||||||
|
|
||||||
ROOT_DIR=../../
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
INCLUDES += -I.
|
|
||||||
INCLUDES += -I$(EPICS_BASE)/include/
|
|
||||||
INCLUDES += -I$(EPICS_BASE)/include/os/Linux/
|
|
||||||
INCLUDES += -I$(EPICS_BASE)/include/compiler/gcc/
|
|
||||||
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/Scheduler/L5GAMs
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/JAEPICSCA$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAEPICSCA$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include depends.$(TARGET)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,293 +0,0 @@
|
|||||||
../..//Build/x86-linux/DataSources/JAEPICSCA/JAEPICSCAInput.o: JAEPICSCAInput.cpp JAEPICSCAInput.h \
|
|
||||||
/opt/codac-6.0/epics/include/cadef.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsAssert.h \
|
|
||||||
/opt/codac-6.0/epics/include/compilerDependencies.h \
|
|
||||||
/opt/codac-6.0/epics/include/compiler/gcc/compilerSpecific.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsGuard.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/ellLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/caerr.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTypes.h \
|
|
||||||
/opt/codac-6.0/epics/include/db_access.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/errMdef.h \
|
|
||||||
/opt/codac-6.0/epics/include/caeventmask.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/ConfigurationDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/AnyObject.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Architecture/x86_gcc/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TypeCharacteristics.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TemplateParametersVerificator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectsDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/StandardHeap.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorInformation.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ErrorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Architecture/x86_gcc/HighResolutionTimerA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimerCalibrator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../Generic/StandardHeap_Generic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FastPollingMutexSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Atomic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Architecture/x86_gcc/AtomicA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Sleep.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Introspection.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/IntrospectionEntry.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TypeDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BasicType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/IteratorT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Iterator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/LoadableLibrary.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticList.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Matrix.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapManager.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StringHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/CLASSREGISTER.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItemT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/TypeConversion.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/CharBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/BufferedStreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FormatDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/IOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/MemoryOperationsHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamStringIOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Reference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerNode.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilterObjectName.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/StatefulI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/ExecutionInfo.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/Threads.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/ExceptionHandler.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ProcessorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/EventSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/SingleThreadService.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThreadI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThread.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/AdvancedErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamMemoryReference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapInputBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/BrokerI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/ExecutableI.h
|
|
||||||
../..//Build/x86-linux/DataSources/JAEPICSCA/EPICSCAOutput.o: EPICSCAOutput.cpp EPICSCAOutput.h \
|
|
||||||
/opt/codac-6.0/epics/include/cadef.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsAssert.h \
|
|
||||||
/opt/codac-6.0/epics/include/compilerDependencies.h \
|
|
||||||
/opt/codac-6.0/epics/include/compiler/gcc/compilerSpecific.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsGuard.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/ellLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/caerr.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTypes.h \
|
|
||||||
/opt/codac-6.0/epics/include/db_access.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/errMdef.h \
|
|
||||||
/opt/codac-6.0/epics/include/caeventmask.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/ConfigurationDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/AnyObject.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Architecture/x86_gcc/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TypeCharacteristics.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TemplateParametersVerificator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectsDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/StandardHeap.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorInformation.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ErrorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Architecture/x86_gcc/HighResolutionTimerA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimerCalibrator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../Generic/StandardHeap_Generic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FastPollingMutexSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Atomic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Architecture/x86_gcc/AtomicA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Sleep.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Introspection.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/IntrospectionEntry.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TypeDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BasicType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/IteratorT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Iterator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/LoadableLibrary.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticList.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Matrix.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapManager.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StringHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/CLASSREGISTER.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItemT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/TypeConversion.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/CharBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/BufferedStreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FormatDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/IOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/MemoryOperationsHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamStringIOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Reference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerNode.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilterObjectName.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/StatefulI.h \
|
|
||||||
EPICSCAInput.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/ExecutionInfo.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/Threads.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/ExceptionHandler.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ProcessorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/EventSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/SingleThreadService.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThreadI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThread.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/AdvancedErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamMemoryReference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L5GAMs/MemoryMapAsyncOutputBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/BrokerI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/ExecutableI.h
|
|
||||||
@@ -1,293 +0,0 @@
|
|||||||
JAEPICSCAInput.o: JAEPICSCAInput.cpp JAEPICSCAInput.h \
|
|
||||||
/opt/codac-6.0/epics/include/cadef.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsAssert.h \
|
|
||||||
/opt/codac-6.0/epics/include/compilerDependencies.h \
|
|
||||||
/opt/codac-6.0/epics/include/compiler/gcc/compilerSpecific.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsGuard.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/ellLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/caerr.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTypes.h \
|
|
||||||
/opt/codac-6.0/epics/include/db_access.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/errMdef.h \
|
|
||||||
/opt/codac-6.0/epics/include/caeventmask.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/ConfigurationDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/AnyObject.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Architecture/x86_gcc/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TypeCharacteristics.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TemplateParametersVerificator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectsDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/StandardHeap.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorInformation.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ErrorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Architecture/x86_gcc/HighResolutionTimerA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimerCalibrator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../Generic/StandardHeap_Generic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FastPollingMutexSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Atomic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Architecture/x86_gcc/AtomicA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Sleep.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Introspection.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/IntrospectionEntry.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TypeDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BasicType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/IteratorT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Iterator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/LoadableLibrary.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticList.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Matrix.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapManager.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StringHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/CLASSREGISTER.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItemT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/TypeConversion.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/CharBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/BufferedStreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FormatDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/IOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/MemoryOperationsHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamStringIOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Reference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerNode.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilterObjectName.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/StatefulI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/ExecutionInfo.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/Threads.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/ExceptionHandler.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ProcessorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/EventSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/SingleThreadService.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThreadI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThread.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/AdvancedErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamMemoryReference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapInputBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/BrokerI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/ExecutableI.h
|
|
||||||
EPICSCAOutput.o: EPICSCAOutput.cpp EPICSCAOutput.h \
|
|
||||||
/opt/codac-6.0/epics/include/cadef.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsAssert.h \
|
|
||||||
/opt/codac-6.0/epics/include/compilerDependencies.h \
|
|
||||||
/opt/codac-6.0/epics/include/compiler/gcc/compilerSpecific.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsGuard.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdMutex.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdThread.h \
|
|
||||||
/opt/codac-6.0/epics/include/shareLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/ellLib.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsEvent.h \
|
|
||||||
/opt/codac-6.0/epics/include/caerr.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTypes.h \
|
|
||||||
/opt/codac-6.0/epics/include/db_access.h \
|
|
||||||
/opt/codac-6.0/epics/include/epicsTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/os/Linux/osdTime.h \
|
|
||||||
/opt/codac-6.0/epics/include/errMdef.h \
|
|
||||||
/opt/codac-6.0/epics/include/caeventmask.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/ConfigurationDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/AnyObject.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Architecture/x86_gcc/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CompilerTypes.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TypeCharacteristics.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/TemplateParametersVerificator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectsDatabase.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/GlobalObjectI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/StandardHeap.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../ErrorInformation.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ErrorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Architecture/x86_gcc/HighResolutionTimerA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/HighResolutionTimerCalibrator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../../Environment/Linux/../../GeneralDefinitions.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeStamp.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Environment/Linux/../Generic/StandardHeap_Generic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FastPollingMutexSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Atomic.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Architecture/x86_gcc/AtomicA.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HighResolutionTimer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/Sleep.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/CString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Introspection.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/IntrospectionEntry.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TypeDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BasicType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/FractionalInteger.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitRange.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/BitBoolean.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/ZeroTerminatedArray.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/IteratorT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Iterator.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListable.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SortFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilterT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/SearchFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/LoadableLibrary.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticList.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StaticListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Matrix.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapManager.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/HeapI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StringHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/AnyType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/CLASSREGISTER.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassRegistryItemT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ObjectBuilderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L4Configuration/TypeConversion.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/Vector.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/StreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamString.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/CharBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/BufferedStreamI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/TimeoutType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/FormatDescriptor.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/IOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/MemoryOperationsHelper.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamStringIOBuffer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/StructuredDataI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Reference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/Object.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L0Types/LinkedListHolder.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilter.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerNode.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainerFilterObjectName.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ReferenceContainer.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/StatefulI.h \
|
|
||||||
EPICSCAInput.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/ExecutionInfo.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/Threads.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/ExceptionHandler.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L1Portability/ProcessorType.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L1Portability/EventSem.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/SingleThreadService.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedServiceMethodBinderT.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThreadI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L3Services/EmbeddedThread.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/AdvancedErrorManagement.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L2Objects/ClassProperties.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L3Streams/StreamMemoryReference.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/Scheduler/L5GAMs/MemoryMapAsyncOutputBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/MemoryMapBroker.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/BrokerI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/DataSourceI.h \
|
|
||||||
/home/codac-dev/MARTe2-dev/MARTe2/Source/Core/BareMetal/L5GAMs/ExecutableI.h
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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 $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
SPB = RandomDataSource.x NI6528.x JAEPICSCA.x
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
ROOT_DIR=..
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) check-env
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
check-env:
|
|
||||||
ifndef MARTe2_DIR
|
|
||||||
$(error MARTe2_DIR is undefined)
|
|
||||||
endif
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
LIBRARIES += -L$(CODAC_ROOT)/lib/ -lpxi6528
|
|
||||||
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=NI6528.x
|
|
||||||
|
|
||||||
PACKAGE=DataSources
|
|
||||||
|
|
||||||
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$(CODAC_ROOT)/include/
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/NI6528$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/NI6528$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file NI6528.cpp
|
|
||||||
* @brief Source file for class NI6528
|
|
||||||
* @date 01/03/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 NI6528 (public, protected, and private). Be aware that some
|
|
||||||
* methods, such as those inline could be defined on the header file, instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
#include "CompilerTypes.h"
|
|
||||||
#include "NI6528.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
NI6528::NI6528() :
|
|
||||||
MARTe::DataSourceI() {
|
|
||||||
using namespace MARTe;
|
|
||||||
previousValue = 0u;
|
|
||||||
value = 0u;
|
|
||||||
port = 0u;
|
|
||||||
boardFileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NI6528::~NI6528() {
|
|
||||||
using namespace MARTe;
|
|
||||||
(void) pxi6528_close_device(boardFileDescriptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::SetConfiguredDatabase(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (DataSourceI::SetConfiguredDatabase(data));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "DataSourceI::SetConfiguredDatabas() failed");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetNumberOfSignals() == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetNumberOfSignals() != 1u");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetSignalType(0u) == UnsignedInteger8Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetSignalType(0u) != UnsignedInteger8Bit");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = DataSourceI::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("Port", port);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The Port shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("DeviceName", deviceName);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The DeviceName shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int32 ret = pxi6528_open_device(&boardFileDescriptor, deviceName.Buffer(), O_NONBLOCK);
|
|
||||||
ok = (ret == 0);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString err = strerror(-ret);
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Could not open device (%s) : %s", deviceName.Buffer(), err.Buffer());
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::Synchronise() {
|
|
||||||
using namespace MARTe;
|
|
||||||
if(previousValue != value){
|
|
||||||
int32 ret = (pxi6528_write_port(boardFileDescriptor, port, value) > 0);
|
|
||||||
previousValue = value;
|
|
||||||
bool ok = (ret > -1);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString err = strerror(-ret);
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Could not write to device (%s) : %s", deviceName.Buffer(), err.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::AllocateMemory() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress) {
|
|
||||||
signalAddress = &value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MARTe::char8 *NI6528::GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction) {
|
|
||||||
using namespace MARTe;
|
|
||||||
return "MemoryMapSynchronisedOutputBroker";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NI6528::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(NI6528, "1.0")
|
|
||||||
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file NI6528.h
|
|
||||||
* @brief Header file for class NI6528
|
|
||||||
* @date 07/06/2018
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 NI6528
|
|
||||||
* 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 RANDOM_DATASOURCE_H_
|
|
||||||
#define RANDOM_DATASOURCE_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include <pxi6528.h>
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @brief NI6528 simplified data source implementation.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantities are only given as an example):
|
|
||||||
* +NI6528 = {
|
|
||||||
* Class = NI6528
|
|
||||||
* DeviceName = "/dev/pxi6528.0" //Mandatory
|
|
||||||
* Port = 0 //The port where to write
|
|
||||||
* Signals = {
|
|
||||||
* currentValue = {Type = uint8}
|
|
||||||
* bitmask = {Type = uint8}
|
|
||||||
* Value = {Type = uint8}
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
class NI6528: public MARTe::DataSourceI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Constructor. NOOP.
|
|
||||||
*/
|
|
||||||
NI6528 ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor. NOOP.
|
|
||||||
*/
|
|
||||||
virtual ~NI6528();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The configuration data detailed in the class description
|
|
||||||
* @return true if all the compulsory parameters are set.
|
|
||||||
*/
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Verifies that at most one signal has been set with the correct type (i.e. any integer).
|
|
||||||
* @return true if the above conditions are met.
|
|
||||||
*/
|
|
||||||
virtual bool SetConfiguredDatabase(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::Synchronise
|
|
||||||
*/
|
|
||||||
virtual bool Synchronise();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::AllocateMemory
|
|
||||||
*/
|
|
||||||
virtual bool AllocateMemory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::GetSignalMemoryBuffer
|
|
||||||
*/
|
|
||||||
virtual bool GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return "MemoryMapSynchronisedInputBroker"
|
|
||||||
*/
|
|
||||||
virtual const MARTe::char8 *GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief NOOP
|
|
||||||
*/
|
|
||||||
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* The previous value to write.
|
|
||||||
*/
|
|
||||||
MARTe::uint8 previousValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The bitmask to write value. (new value) = (current value) || (bitmask) && (write value)
|
|
||||||
*/
|
|
||||||
MARTe::uint8 bitmask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The value to write.
|
|
||||||
*/
|
|
||||||
MARTe::uint8 value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The port number
|
|
||||||
*/
|
|
||||||
MARTe::uint32 port;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The board file descriptor
|
|
||||||
*/
|
|
||||||
pxi6528_device_t boardFileDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The device name
|
|
||||||
*/
|
|
||||||
MARTe::StreamString deviceName;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* RANDOM_DATASOURCE_H_ */
|
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=RandomDataSource.x
|
|
||||||
|
|
||||||
PACKAGE=DataSources
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/RandomDataSource$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/RandomDataSource$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file RandomDataSource.cpp
|
|
||||||
* @brief Source file for class RandomDataSource
|
|
||||||
* @date 01/03/2017
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 RandomDataSource (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 "AdvancedErrorManagement.h"
|
|
||||||
#include "CompilerTypes.h"
|
|
||||||
#include "RandomDataSource.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
RandomDataSource::RandomDataSource() :
|
|
||||||
MARTe::DataSourceI() {
|
|
||||||
using namespace MARTe;
|
|
||||||
seed = 0u;
|
|
||||||
signalPtr = NULL_PTR(MARTe::char8 *);
|
|
||||||
signalTypeDescriptor = UnsignedInteger8Bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
RandomDataSource::~RandomDataSource() {
|
|
||||||
using namespace MARTe;
|
|
||||||
if (signalPtr) {
|
|
||||||
delete[] signalPtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::SetConfiguredDatabase(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (DataSourceI::SetConfiguredDatabase(data));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "DataSourceI::SetConfiguredDatabas() failed");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (GetNumberOfSignals() == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetNumberOfSignals() != 1u");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
signalTypeDescriptor = GetSignalType(0u);
|
|
||||||
ok = (signalTypeDescriptor.type == UnsignedInteger);
|
|
||||||
if (!ok) {
|
|
||||||
ok = (signalTypeDescriptor.type == SignedInteger);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "GetSignalType(0u) != Un/SignedInteger");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = DataSourceI::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("Seed", seed);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "The Seed shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::Synchronise() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (signalTypeDescriptor.numberOfBits == 8u) {
|
|
||||||
GetValue<uint8>();
|
|
||||||
}
|
|
||||||
if (signalTypeDescriptor.numberOfBits == 16u) {
|
|
||||||
GetValue<uint16>();
|
|
||||||
}
|
|
||||||
if (signalTypeDescriptor.numberOfBits == 32u) {
|
|
||||||
GetValue<uint32>();
|
|
||||||
}
|
|
||||||
if (signalTypeDescriptor.numberOfBits == 64u) {
|
|
||||||
GetValue<uint64>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::AllocateMemory() {
|
|
||||||
signalPtr = new MARTe::char8[signalTypeDescriptor.numberOfBits];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress) {
|
|
||||||
signalAddress = &signalPtr[0];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MARTe::char8 *RandomDataSource::GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction) {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
static bool firstTime = true;
|
|
||||||
const char8 * broker;// = NULL_PTR(const char8 *);
|
|
||||||
if (firstTime) {
|
|
||||||
broker = "MemoryMapSynchronisedInputBroker";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
firstTime = false;
|
|
||||||
broker = "MemoryMapInputBroker";
|
|
||||||
}
|
|
||||||
return broker;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RandomDataSource::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(RandomDataSource, "1.0")
|
|
||||||
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file RandomDataSource.h
|
|
||||||
* @brief Header file for class RandomDataSource
|
|
||||||
* @date 07/06/2018
|
|
||||||
* @author Andre Neto
|
|
||||||
*
|
|
||||||
* @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 RandomDataSource
|
|
||||||
* 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 RANDOM_DATASOURCE_H_
|
|
||||||
#define RANDOM_DATASOURCE_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @brief DataDource which generates random numbers against a given seed.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantities are only given as an example):
|
|
||||||
* +RandomDataSource = {
|
|
||||||
* Class = RandomDataSource
|
|
||||||
* Seed = 8 //Seed against which the the seed will be generated. Note that each signal
|
|
||||||
* Signals = {
|
|
||||||
* Random1 = { //Maximum one signal
|
|
||||||
* Type = uint64 //All the integer types are supported
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
class RandomDataSource: public MARTe::DataSourceI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Constructor. NOOP.
|
|
||||||
*/
|
|
||||||
RandomDataSource ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor. NOOP.
|
|
||||||
*/
|
|
||||||
virtual ~RandomDataSource();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The configuration data detailed in the class description
|
|
||||||
* @return true if all the compulsory parameters are set.
|
|
||||||
*/
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Verifies that at most one signal has been set with the correct type (i.e. any integer).
|
|
||||||
* @return true if the above conditions are met.
|
|
||||||
*/
|
|
||||||
virtual bool SetConfiguredDatabase(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::Synchronise
|
|
||||||
*/
|
|
||||||
virtual bool Synchronise();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::AllocateMemory
|
|
||||||
*/
|
|
||||||
virtual bool AllocateMemory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief @see DataSourceI::GetSignalMemoryBuffer
|
|
||||||
*/
|
|
||||||
virtual bool GetSignalMemoryBuffer(const MARTe::uint32 signalIdx, const MARTe::uint32 bufferIdx, void *&signalAddress);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return "MemoryMapSynchronisedInputBroker"
|
|
||||||
*/
|
|
||||||
virtual const MARTe::char8 *GetBrokerName(MARTe::StructuredDataI &data, const MARTe::SignalDirection direction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief NOOP
|
|
||||||
*/
|
|
||||||
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* The seed to compute the signals.
|
|
||||||
*/
|
|
||||||
MARTe::uint32 seed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The signal pointer
|
|
||||||
*/
|
|
||||||
MARTe::char8 *signalPtr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The signal type descriptor.
|
|
||||||
*/
|
|
||||||
MARTe::TypeDescriptor signalTypeDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute the random value
|
|
||||||
*/
|
|
||||||
template<typename T>
|
|
||||||
void GetValue();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
template<typename T>
|
|
||||||
void RandomDataSource::GetValue() {
|
|
||||||
*(reinterpret_cast<T *>(&signalPtr[0u])) = static_cast<T>(rand_r(&seed));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* RANDOM_DATASOURCE_H_ */
|
|
||||||
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JABitReverseGAM.cpp
|
|
||||||
* @brief Source file for class JABitReverseGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JABitReverseGAM (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 "JABitReverseGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JABitReverseGAM::JABitReverseGAM() {
|
|
||||||
//Input signals.
|
|
||||||
input1 = NULL_PTR(MARTe::uint8 *);
|
|
||||||
|
|
||||||
//Output signals.
|
|
||||||
output1= NULL_PTR(MARTe::uint8 *);
|
|
||||||
}
|
|
||||||
|
|
||||||
JABitReverseGAM::~JABitReverseGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitReverseGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
//GAM parameters are initialized.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitReverseGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
//This method changes internal parameter based on next realtime state.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitReverseGAM::Setup() {
|
|
||||||
// Setup memory for input/output signals on the GAM.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 1u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "One output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "One input signals shall be defined");
|
|
||||||
}
|
|
||||||
// Do type check for input signals.
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
ok = ((inputType == UnsignedInteger8Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint8.", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type check for output signals
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = ((outputType == UnsignedInteger8Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint8.", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type cast.
|
|
||||||
if (ok) {
|
|
||||||
input1 = reinterpret_cast<uint8 *>(GetInputSignalMemory(0));
|
|
||||||
|
|
||||||
output1 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(0));
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitReverseGAM::Execute() {
|
|
||||||
// This method is called every realtime state thread cycle.
|
|
||||||
using namespace MARTe;
|
|
||||||
*output1 = ~(*input1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JABitReverseGAM, "1.0")
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JABitReverseGAM.h
|
|
||||||
* @brief Header file for class JABitReverseGAM
|
|
||||||
* @date Mar 18, 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 JABitReverseGAM
|
|
||||||
* 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_JABitReverseGAM_H_
|
|
||||||
#define GAMS_JABitReverseGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class JABitReverseGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JABitReverseGAM();
|
|
||||||
|
|
||||||
virtual ~JABitReverseGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
MARTe::uint8 *input1;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint8 *output1;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JABitReverseGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JABitReverseGAM.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)/JABitReverseGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JABitReverseGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JABitSumGAM.cpp
|
|
||||||
* @brief Source file for class JABitSumGAM
|
|
||||||
* @date Feb 10, 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 source file contains the definition of all the methods for
|
|
||||||
* the class JABitSumGAM (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 "JABitSumGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JABitSumGAM::JABitSumGAM() {
|
|
||||||
//Input signals.
|
|
||||||
input0 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input1 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input2 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input3 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input4 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input5 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input6 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input7 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
//Output signals.
|
|
||||||
output= NULL_PTR(MARTe::uint8 *);
|
|
||||||
}
|
|
||||||
|
|
||||||
JABitSumGAM::~JABitSumGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitSumGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
//GAM parameters are initialized.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (!ok){
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "ParametersError in init.");
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitSumGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
//This method changes internal parameter based on next realtime state.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitSumGAM::Setup() {
|
|
||||||
// Setup memory for input/output signals on the GAM.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 8u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "One output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Eight input signals shall be defined");
|
|
||||||
}
|
|
||||||
// Do type check for input signals.
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32.", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type check for output signals
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = (outputType == UnsignedInteger8Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint8.", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type cast.
|
|
||||||
if (ok) {
|
|
||||||
input0 = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
input1 = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
|
||||||
input2 = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
|
||||||
input3 = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
|
||||||
input4 = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
|
||||||
input5 = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
|
||||||
input6 = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
|
||||||
input7 = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
|
||||||
|
|
||||||
output = reinterpret_cast<uint8 *>(GetOutputSignalMemory(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JABitSumGAM::Execute() {
|
|
||||||
// This method is called every realtime state thread cycle.
|
|
||||||
using namespace MARTe;
|
|
||||||
*output = *input0 + *input1*2 + *input2*4 + *input3*8 + *input4*16 +
|
|
||||||
*input5*32 + *input6*64 + *input7*128;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JABitSumGAM, "1.0")
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JABitSumGAM.h
|
|
||||||
* @brief Header file for class JABitSumGAM
|
|
||||||
* @date Feb 10, 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 JABitSumGAM
|
|
||||||
* 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_JABitSumGAM_H_
|
|
||||||
#define GAMS_JABitSumGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
#include "stdio.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class JABitSumGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JABitSumGAM();
|
|
||||||
|
|
||||||
virtual ~JABitSumGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
// Input signals
|
|
||||||
MARTe::uint32 *input0;
|
|
||||||
MARTe::uint32 *input1;
|
|
||||||
MARTe::uint32 *input2;
|
|
||||||
MARTe::uint32 *input3;
|
|
||||||
MARTe::uint32 *input4;
|
|
||||||
MARTe::uint32 *input5;
|
|
||||||
MARTe::uint32 *input6;
|
|
||||||
MARTe::uint32 *input7;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint8 *output;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JABitSumGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,309 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAConditionalSignalUpdateGAM.cpp
|
|
||||||
* @brief Source file for class JAConditionalSignalUpdateGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAConditionalSignalUpdateGAM (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 "JAConditionalSignalUpdateGAM.h"
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM::JAConditionalSignalUpdateGAM() {
|
|
||||||
inputSignals = NULL_PTR(void **);
|
|
||||||
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
|
||||||
values = NULL_PTR(MARTe::uint32 *);
|
|
||||||
valuesCount = 0u;
|
|
||||||
outputSignals = NULL_PTR(MARTe::uint32 **);
|
|
||||||
defaultValues = NULL_PTR(MARTe::uint32 **);
|
|
||||||
needsReset = false;
|
|
||||||
expectedValues = NULL_PTR(MARTe::uint32 *);
|
|
||||||
expectedValuesCount = 0u;
|
|
||||||
operation = And;
|
|
||||||
comparators = NULL_PTR(ComparisonMode *);
|
|
||||||
}
|
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM::~JAConditionalSignalUpdateGAM() {
|
|
||||||
if (outputSignals != NULL_PTR(MARTe::uint32 **)) {
|
|
||||||
delete[] outputSignals;
|
|
||||||
}
|
|
||||||
if (inputSignals != NULL_PTR(void **)) {
|
|
||||||
delete[] inputSignals;
|
|
||||||
}
|
|
||||||
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
|
||||||
delete[] inputSignalTypes;
|
|
||||||
}
|
|
||||||
if (values != NULL_PTR(MARTe::uint32 *)) {
|
|
||||||
delete[] values;
|
|
||||||
}
|
|
||||||
if (comparators != NULL_PTR(ComparisonMode *)) {
|
|
||||||
delete[] comparators;
|
|
||||||
}
|
|
||||||
if (defaultValues != NULL_PTR(MARTe::uint32 **)) {
|
|
||||||
delete[] defaultValues;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
// Read expected values.
|
|
||||||
AnyType valuesArray = data.GetType("ExpectedValues");
|
|
||||||
|
|
||||||
if (valuesArray.GetDataPointer() != NULL) {
|
|
||||||
expectedValuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
|
|
||||||
expectedValues = new uint32[expectedValuesCount];
|
|
||||||
|
|
||||||
Vector<uint32> valuesVector(expectedValues, expectedValuesCount);
|
|
||||||
ok = (data.Read("ExpectedValues", valuesVector));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
// Read comparators.
|
|
||||||
AnyType comparatorsArray = data.GetType("Comparators");
|
|
||||||
if (comparatorsArray.GetDataPointer() != NULL) {
|
|
||||||
uint32 count;
|
|
||||||
if (ok) {
|
|
||||||
count = comparatorsArray.GetNumberOfElements(0u);
|
|
||||||
ok = count == expectedValuesCount;
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
comparators = new ComparisonMode[count];
|
|
||||||
StreamString* comp = new StreamString[count];
|
|
||||||
Vector<StreamString> compVector(comp, count);
|
|
||||||
|
|
||||||
ok = (data.Read("Comparators", compVector));
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
|
||||||
if (comp[i] == "EQUALS") {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
} else if (comp[i] == "NOT") {
|
|
||||||
comparators[i] = Not;
|
|
||||||
} else if (comp[i] == "GREATER") {
|
|
||||||
comparators[i] = Greater;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_GREATER") {
|
|
||||||
comparators[i] = EqualsOrGreater;
|
|
||||||
} else if (comp[i] == "LESS") {
|
|
||||||
comparators[i] = Less;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_LESS") {
|
|
||||||
comparators[i] = EqualsOrLess;
|
|
||||||
} else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Comparator %s is not defined.", comp[i].Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] comp;
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
|
||||||
"number of elements.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Create default comparators (equals) when they aren't provided in the configuration.
|
|
||||||
comparators = new ComparisonMode[expectedValuesCount];
|
|
||||||
for (uint32 i = 0; i < expectedValuesCount; ++i) {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
MARTe::StreamString operationStr;
|
|
||||||
if (data.Read("Operation", operationStr)) {
|
|
||||||
if (operationStr == "AND") {
|
|
||||||
operation = And;
|
|
||||||
}
|
|
||||||
else if (operationStr == "OR") {
|
|
||||||
operation = Or;
|
|
||||||
}
|
|
||||||
else if (operationStr == "NOR") {
|
|
||||||
operation = Nor;
|
|
||||||
}
|
|
||||||
else if (operationStr == "XOR") {
|
|
||||||
operation = Xor;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Operation %s is not defined", operationStr.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
// Read output signal values to be set.
|
|
||||||
AnyType valuesArray = data.GetType("Values");
|
|
||||||
ok = (valuesArray.GetDataPointer() != NULL);
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
valuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
ok = valuesCount > 0u;
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
values = new uint32[valuesCount];
|
|
||||||
|
|
||||||
Vector<uint32> valuesVector(values, valuesCount);
|
|
||||||
ok = (data.Read("Values", valuesVector));
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Values shall be defined.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = numberOfInputSignals == (expectedValuesCount + numberOfOutputSignals);
|
|
||||||
if (ok) {
|
|
||||||
inputSignals = new void*[expectedValuesCount];
|
|
||||||
defaultValues = new uint32*[numberOfOutputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < expectedValuesCount; i++) {
|
|
||||||
inputSignals[i] = GetInputSignalMemory(i);
|
|
||||||
}
|
|
||||||
for (; i < numberOfInputSignals; i++) {
|
|
||||||
defaultValues[i - expectedValuesCount] = reinterpret_cast<uint32 *>(GetInputSignalMemory(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be equal to number "
|
|
||||||
"of expected values plus number of output signals.");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
inputSignalTypes = new TypeDescriptor[expectedValuesCount];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; (i < expectedValuesCount) && (ok); i++) {
|
|
||||||
inputSignalTypes[i] = GetSignalType(InputSignals, i);
|
|
||||||
ok = ((inputSignalTypes[i] == UnsignedInteger32Bit) || (inputSignalTypes[i] == UnsignedInteger16Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or uint16", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfOutputSignals == valuesCount;
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfOutputSignals > 0u;
|
|
||||||
if (ok) {
|
|
||||||
outputSignals = new uint32*[numberOfOutputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; i++) {
|
|
||||||
outputSignals[i] = reinterpret_cast<uint32 *>(GetOutputSignalMemory(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of output signals shall be the same as "
|
|
||||||
"number of provided values.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
needsReset = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Execute() {
|
|
||||||
if (!needsReset) {
|
|
||||||
bool eventDetected = expectedValuesCount == 0;
|
|
||||||
if (!eventDetected) {
|
|
||||||
if (operation == Or) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
for (j = 0; (j < expectedValuesCount) && (!eventDetected); j++) {
|
|
||||||
eventDetected = Compare(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Nor) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
for (j = 0; (j < expectedValuesCount) && (!eventDetected); j++) {
|
|
||||||
eventDetected = Compare(j);
|
|
||||||
}
|
|
||||||
eventDetected = !eventDetected;
|
|
||||||
}
|
|
||||||
else if (operation == And) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
eventDetected = Compare(0);
|
|
||||||
for (j = 1; (j < expectedValuesCount); j++) {
|
|
||||||
eventDetected &= Compare(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Xor) {
|
|
||||||
MARTe::uint32 j;
|
|
||||||
MARTe::uint32 eventDetectedUint32;
|
|
||||||
if (inputSignalTypes[0] == MARTe::UnsignedInteger32Bit) {
|
|
||||||
eventDetectedUint32 = *static_cast<MARTe::uint32 *>(inputSignals[0]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
eventDetectedUint32 = *static_cast<MARTe::uint16 *>(inputSignals[0]);
|
|
||||||
}
|
|
||||||
for (j = 1; (j < expectedValuesCount); j++) {
|
|
||||||
eventDetectedUint32 ^= Compare(j);
|
|
||||||
}
|
|
||||||
eventDetected = (eventDetectedUint32 == 1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (eventDetected) {
|
|
||||||
needsReset = true;
|
|
||||||
MARTe::uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
|
||||||
*outputSignals[i] = values[i];
|
|
||||||
MARTe::StreamString signalName;
|
|
||||||
(void) GetSignalName(MARTe::OutputSignals, i, signalName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MARTe::uint32 i;
|
|
||||||
for (i = 0u; i < numberOfOutputSignals; ++i) {
|
|
||||||
*outputSignals[i] = *defaultValues[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
|
||||||
if (inputSignalTypes[index] == MARTe::UnsignedInteger32Bit) {
|
|
||||||
return Compare<MARTe::uint32>(index);
|
|
||||||
}
|
|
||||||
return Compare<MARTe::uint16>(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAConditionalSignalUpdateGAM, "1.0")
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAConditionalSignalUpdateGAM.h
|
|
||||||
* @brief Header file for class JAConditionalSignalUpdateGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAConditionalSignalUpdateGAM
|
|
||||||
* 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_JACONDITIONALSIGNALUPDATEGAM_H_
|
|
||||||
#define GAMS_JACONDITIONALSIGNALUPDATEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that writes predefined values to output signals when a condition is met.
|
|
||||||
* If there are no conditional signals provided, the condition is presumed to be met.
|
|
||||||
*
|
|
||||||
* +ASYNCShotlengthControlGAM = {
|
|
||||||
* Class = JAConditionalSignalUpdateGAM
|
|
||||||
* Operation = OR // Logical operation performed between conditional signals
|
|
||||||
* // Supported values: AND, OR, XOR, NOR
|
|
||||||
* // Default: AND
|
|
||||||
* ExpectedValues = {1 1} // Values to which conditional signals will be compared.
|
|
||||||
* Comparators = {EQUALS EQUALS} // Operator between conditional signal an expected value
|
|
||||||
* // Supported values: EQUALS, NOT, GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
|
|
||||||
* // Default: EQUALS
|
|
||||||
* Values = {0 3} // Values that will be written to output signals when condition is met.
|
|
||||||
* InputSignals = {
|
|
||||||
* // Conditional Signals
|
|
||||||
* SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* // Default values (set to output signals before the condition is met)
|
|
||||||
* APS_SWON = { // APS_SWON will keep the value from previous state.
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON_DEFAULT = { // BPS_SWON will be set to 7 before condition is met.
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* Default = 7
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* APS_SWON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
class JAConditionalSignalUpdateGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JAConditionalSignalUpdateGAM();
|
|
||||||
|
|
||||||
virtual ~JAConditionalSignalUpdateGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
/**
|
|
||||||
* @brief Does the input signal at provided index have the expected value.
|
|
||||||
* @param[in] index of the signal.
|
|
||||||
* @return true if the signal has expected value.
|
|
||||||
*/
|
|
||||||
bool Compare(MARTe::uint32 index);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool Compare(MARTe::uint32 index);
|
|
||||||
|
|
||||||
enum OperationMode {
|
|
||||||
And, Or, Xor, Nor
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ComparisonMode {
|
|
||||||
Equals, Not, Greater, EqualsOrGreater, Less, EqualsOrLess
|
|
||||||
};
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
void **inputSignals;
|
|
||||||
|
|
||||||
MARTe::TypeDescriptor *inputSignalTypes;
|
|
||||||
|
|
||||||
// Condition operation.
|
|
||||||
OperationMode operation;
|
|
||||||
|
|
||||||
// Array of expected values of input signals.
|
|
||||||
MARTe::uint32* expectedValues;
|
|
||||||
|
|
||||||
// Expected values count (must be equal to numberOfInputSignals)
|
|
||||||
MARTe::uint32 expectedValuesCount;
|
|
||||||
|
|
||||||
// Array of comparators
|
|
||||||
ComparisonMode* comparators;
|
|
||||||
|
|
||||||
// Values to be written on output signals when input signal has the expected value.
|
|
||||||
MARTe::uint32 *values;
|
|
||||||
|
|
||||||
// Number of values (must be equal to numberOfOutputSignals)
|
|
||||||
MARTe::uint32 valuesCount;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint32 **outputSignals;
|
|
||||||
|
|
||||||
// Default values of output signals
|
|
||||||
MARTe::uint32 **defaultValues;
|
|
||||||
|
|
||||||
// Were output signals already set and we are waiting for a state change before they are set again.
|
|
||||||
bool needsReset;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool JAConditionalSignalUpdateGAM::Compare(MARTe::uint32 index) {
|
|
||||||
switch (comparators[index]) {
|
|
||||||
case Equals:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) == static_cast<T>(expectedValues[index]);
|
|
||||||
case Not:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) != static_cast<T>(expectedValues[index]);
|
|
||||||
case Greater:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) > static_cast<T>(expectedValues[index]);
|
|
||||||
case EqualsOrGreater:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) >= static_cast<T>(expectedValues[index]);
|
|
||||||
case Less:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) < static_cast<T>(expectedValues[index]);
|
|
||||||
default: // case EqualsOrLess:
|
|
||||||
return *static_cast<T *>(inputSignals[index]) <= static_cast<T>(expectedValues[index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* GAMS_JACONDITIONALSIGNALUPDATEGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAConditionalSignalUpdateGAM.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
|
|
||||||
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/JAConditionalSignalUpdateGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAConditionalSignalUpdateGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,347 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAMessageGAM.cpp
|
|
||||||
* @brief Source file for class JAMessageGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAMessageGAM (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 "AdvancedErrorManagement.h"
|
|
||||||
#include "JAMessageGAM.h"
|
|
||||||
#include "MessageI.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class T, class U>
|
|
||||||
bool Compare(JAMessageGAM::ComparisonMode comparator, void *inputSignal, U expectedValue) {
|
|
||||||
switch (comparator) {
|
|
||||||
case JAMessageGAM::Equals:
|
|
||||||
return *static_cast<T *>(inputSignal) == expectedValue;
|
|
||||||
case JAMessageGAM::Not:
|
|
||||||
return *static_cast<T *>(inputSignal) != expectedValue;
|
|
||||||
case JAMessageGAM::Greater:
|
|
||||||
return *static_cast<T *>(inputSignal) > expectedValue;
|
|
||||||
case JAMessageGAM::EqualsOrGreater:
|
|
||||||
return *static_cast<T *>(inputSignal) >= expectedValue;
|
|
||||||
case JAMessageGAM::Less:
|
|
||||||
return *static_cast<T *>(inputSignal) < expectedValue;
|
|
||||||
default: // case EqualsOrLess:
|
|
||||||
return *static_cast<T *>(inputSignal) <= expectedValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JAMessageGAM::JAMessageGAM() {
|
|
||||||
inputSignals = NULL_PTR(void **);
|
|
||||||
inputSignalTypes = NULL_PTR(MARTe::TypeDescriptor *);
|
|
||||||
operation = And;
|
|
||||||
needsReset = false;
|
|
||||||
expectedValuesInt = NULL_PTR(MARTe::uint64 *);
|
|
||||||
expectedValuesFloat = NULL_PTR(MARTe::float64 *);
|
|
||||||
intValuesCount = 0u;
|
|
||||||
floatValuesCount = 0u;
|
|
||||||
comparators = NULL_PTR(ComparisonMode *);
|
|
||||||
}
|
|
||||||
|
|
||||||
JAMessageGAM::~JAMessageGAM() {
|
|
||||||
if (inputSignals != NULL_PTR(void **)) {
|
|
||||||
delete[] inputSignals;
|
|
||||||
}
|
|
||||||
if (inputSignalTypes != NULL_PTR(MARTe::TypeDescriptor *)) {
|
|
||||||
delete[] inputSignalTypes;
|
|
||||||
}
|
|
||||||
if (expectedValuesInt != NULL_PTR(MARTe::uint64 *)) {
|
|
||||||
delete[] expectedValuesInt;
|
|
||||||
}
|
|
||||||
if (expectedValuesFloat != NULL_PTR(MARTe::float64 *)) {
|
|
||||||
delete[] expectedValuesFloat;
|
|
||||||
}
|
|
||||||
if (comparators != NULL_PTR(ComparisonMode *)) {
|
|
||||||
delete[] comparators;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAMessageGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
// Read expected integer values.
|
|
||||||
AnyType valuesArray = data.GetType("ExpectedIntValues");
|
|
||||||
bool intValuesProvided = (valuesArray.GetDataPointer() != NULL);
|
|
||||||
|
|
||||||
if (intValuesProvided) {
|
|
||||||
intValuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
}
|
|
||||||
if (intValuesProvided) {
|
|
||||||
expectedValuesInt = new uint64[intValuesCount];
|
|
||||||
|
|
||||||
Vector<uint64> valuesVector(expectedValuesInt, intValuesCount);
|
|
||||||
ok = (data.Read("ExpectedIntValues", valuesVector));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Failed to read ExpectedIntValues.");
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Read expected float values.
|
|
||||||
valuesArray = data.GetType("ExpectedFloatValues");
|
|
||||||
bool floatValuesProvided = (valuesArray.GetDataPointer() != NULL);
|
|
||||||
|
|
||||||
if (floatValuesProvided) {
|
|
||||||
floatValuesCount = valuesArray.GetNumberOfElements(0u);
|
|
||||||
}
|
|
||||||
if (floatValuesProvided) {
|
|
||||||
expectedValuesFloat = new float64[floatValuesCount];
|
|
||||||
|
|
||||||
Vector<float64> valuesVector(expectedValuesFloat, floatValuesCount);
|
|
||||||
ok = (data.Read("ExpectedFloatValues", valuesVector));
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Failed to read ExpectedFloatValues.");
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ok = (floatValuesCount + intValuesCount) > 0u;
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "ExpectedFloatValues and or ExpectedIntValues shall be defined.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
// Read comparators.
|
|
||||||
AnyType comparatorsArray = data.GetType("Comparators");
|
|
||||||
if (comparatorsArray.GetDataPointer() != NULL) {
|
|
||||||
uint32 count = comparatorsArray.GetNumberOfElements(0u);
|
|
||||||
ok = count == (intValuesCount + floatValuesCount);
|
|
||||||
if (ok) {
|
|
||||||
comparators = new ComparisonMode[count];
|
|
||||||
StreamString* comp = new StreamString[count];
|
|
||||||
Vector<StreamString> compVector(comp, count);
|
|
||||||
|
|
||||||
ok = (data.Read("Comparators", compVector));
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
|
||||||
if (comp[i] == "EQUALS") {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
} else if (comp[i] == "NOT") {
|
|
||||||
comparators[i] = Not;
|
|
||||||
} else if (comp[i] == "GREATER") {
|
|
||||||
comparators[i] = Greater;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_GREATER") {
|
|
||||||
comparators[i] = EqualsOrGreater;
|
|
||||||
} else if (comp[i] == "LESS") {
|
|
||||||
comparators[i] = Less;
|
|
||||||
} else if (comp[i] == "EQUALS_OR_LESS") {
|
|
||||||
comparators[i] = EqualsOrLess;
|
|
||||||
} else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Comparator %s is not defined.", comp[i].Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
|
||||||
"number of elements.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
uint32 count = intValuesCount + floatValuesCount;
|
|
||||||
if (ok) {
|
|
||||||
// Create default comparators (equals) when they aren't provided in the configuration.
|
|
||||||
comparators = new ComparisonMode[count];
|
|
||||||
for (uint32 i = 0; i < count; ++i) {
|
|
||||||
comparators[i] = Equals;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Expected values and operators shall have the same "
|
|
||||||
"number of elements.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
MARTe::StreamString operationStr;
|
|
||||||
if (data.Read("Operation", operationStr)) {
|
|
||||||
if (operationStr == "AND") {
|
|
||||||
operation = And;
|
|
||||||
}
|
|
||||||
else if (operationStr == "OR") {
|
|
||||||
operation = Or;
|
|
||||||
}
|
|
||||||
else if (operationStr == "NOR") {
|
|
||||||
operation = Nor;
|
|
||||||
}
|
|
||||||
else if (operationStr == "XOR") {
|
|
||||||
operation = Xor;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Operation %s is not defined", operationStr.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = (Size() == 1);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "A Message object shall be added to this container");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
eventMsg = Get(0);
|
|
||||||
ok = (eventMsg.IsValid());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "A valid Message shall be added to this container");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAMessageGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = numberOfInputSignals == (intValuesCount + floatValuesCount);
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfInputSignals > 0u;
|
|
||||||
if (ok) {
|
|
||||||
inputSignals = new void*[numberOfInputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < numberOfInputSignals; i++) {
|
|
||||||
inputSignals[i] = GetInputSignalMemory(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "At least one input signal shall be defined");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be the same as "
|
|
||||||
"number of expected values.");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
inputSignalTypes = new TypeDescriptor[numberOfInputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; (i < numberOfInputSignals) && (ok); i++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, i);
|
|
||||||
inputSignalTypes[i] = inputType;
|
|
||||||
ok = (inputType == UnsignedInteger32Bit) || (inputType == SignedInteger32Bit) ||
|
|
||||||
(inputType == UnsignedInteger16Bit) || (inputType == SignedInteger16Bit) ||
|
|
||||||
(inputType == UnsignedInteger8Bit) || (inputType == SignedInteger8Bit) ||
|
|
||||||
(inputType == Float64Bit) || (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal %s shall be defined as 32/16/8 bit signed/unsigned integer "
|
|
||||||
"or as 64/32 float.", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAMessageGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
needsReset = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAMessageGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = true;
|
|
||||||
bool eventDetected = false;
|
|
||||||
uint32 inputPortIndex = 0;
|
|
||||||
uint32 intIndex = 0;
|
|
||||||
uint32 floatIndex = 0;
|
|
||||||
if (operation == Or) {
|
|
||||||
for (inputPortIndex = 0; (inputPortIndex < numberOfInputSignals) && (!eventDetected); inputPortIndex++) {
|
|
||||||
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Nor) {
|
|
||||||
for (inputPortIndex = 0; (inputPortIndex < numberOfInputSignals) && (!eventDetected); inputPortIndex++) {
|
|
||||||
eventDetected = Compare(inputPortIndex, floatIndex, intIndex);
|
|
||||||
}
|
|
||||||
eventDetected = !eventDetected;
|
|
||||||
}
|
|
||||||
else if (operation == And) {
|
|
||||||
eventDetected = Compare(0, floatIndex, intIndex);
|
|
||||||
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals); inputPortIndex++) {
|
|
||||||
eventDetected &= Compare(inputPortIndex, floatIndex, intIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (operation == Xor) {
|
|
||||||
uint32 eventDetectedUInt32 = Compare(inputPortIndex, floatIndex, intIndex);
|
|
||||||
for (inputPortIndex = 1; (inputPortIndex < numberOfInputSignals); inputPortIndex++) {
|
|
||||||
eventDetectedUInt32 ^= Compare(inputPortIndex, floatIndex, intIndex);
|
|
||||||
}
|
|
||||||
eventDetected = (eventDetectedUInt32 == 1u);
|
|
||||||
}
|
|
||||||
if (eventDetected) {
|
|
||||||
if (!needsReset) {
|
|
||||||
ok = (MessageI::SendMessage(eventMsg, this) == ErrorManagement::NoError);
|
|
||||||
needsReset = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAMessageGAM::Compare(MARTe::uint32 inputPortIndex, MARTe::uint32 &floatValueIndex, MARTe::uint32 &intValueIndex) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ret = false;
|
|
||||||
if (inputSignalTypes[inputPortIndex] == UnsignedInteger32Bit) {
|
|
||||||
ret = ::Compare<uint32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger32Bit) {
|
|
||||||
ret = ::Compare<int32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == UnsignedInteger16Bit) {
|
|
||||||
ret = ::Compare<uint16>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger16Bit) {
|
|
||||||
ret = ::Compare<int16>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == UnsignedInteger8Bit) {
|
|
||||||
ret = ::Compare<uint8>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == SignedInteger8Bit) {
|
|
||||||
ret = ::Compare<int8>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesInt[intValueIndex]);
|
|
||||||
++intValueIndex;
|
|
||||||
}
|
|
||||||
else if (inputSignalTypes[inputPortIndex] == Float64Bit) {
|
|
||||||
ret = ::Compare<float64>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesFloat[floatValueIndex]);
|
|
||||||
++floatValueIndex;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = ::Compare<float32>(comparators[inputPortIndex], inputSignals[inputPortIndex], expectedValuesFloat[floatValueIndex]);
|
|
||||||
++floatValueIndex;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAMessageGAM, "1.0")
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAMessageGAM.h
|
|
||||||
* @brief Header file for class JAMessageGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAMessageGAM
|
|
||||||
* 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_JAMESSAGEGAM_H_
|
|
||||||
#define GAMS_JAMESSAGEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
#include "Message.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that sends a message when input signals have expected values. Message will not be sent multiple
|
|
||||||
* times without first changing the application state.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +MessageGAM = {
|
|
||||||
* Class = JAMessageGAM
|
|
||||||
* Operation = AND // Accepted values are: AND, OR, XOR, NOR. Default value is AND.
|
|
||||||
* ExpectedIntValues = {1 10} // Expected values for input signals of integral type.
|
|
||||||
* ExpectedFloatValues = {3.5} // Expected values for float signals of floting point type.
|
|
||||||
* Comparators = {EQUALS GREATER NOT} // Accepted values are: EQUALS, NOT, GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
|
|
||||||
* // Comparators element is optional. Default comparator is EQUALS.
|
|
||||||
* InputSignals = {
|
|
||||||
* Sig1 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* Sig2 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Sig3 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* +Event = { // Message to be sent when condition is true.
|
|
||||||
* Class = Message
|
|
||||||
* Destination = StateMachine
|
|
||||||
* Function = GoDisabled
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
* This example will send Event message when Sig1 == 1 && Sig2 > 3.5 && Sig3 != 10
|
|
||||||
*/
|
|
||||||
class JAMessageGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JAMessageGAM();
|
|
||||||
|
|
||||||
virtual ~JAMessageGAM();
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
enum ComparisonMode {
|
|
||||||
Equals, Not, Greater, EqualsOrGreater, Less, EqualsOrLess
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief Does the input signal at provided index have the expected value.
|
|
||||||
* @param[in] index of the signal.
|
|
||||||
* @param[out] floatValueIndex lookup index for expected float values array.
|
|
||||||
* @param[out] intValueIndex lookup index for expected integer values array.
|
|
||||||
* @return true if the signal has expected value.
|
|
||||||
*/
|
|
||||||
bool Compare(MARTe::uint32 index, MARTe::uint32 &floatValueIndex, MARTe::uint32 &intValueIndex);
|
|
||||||
|
|
||||||
enum OperationMode {
|
|
||||||
And, Or, Xor, Nor
|
|
||||||
};
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
void **inputSignals;
|
|
||||||
|
|
||||||
MARTe::TypeDescriptor *inputSignalTypes;
|
|
||||||
|
|
||||||
// Condition operation.
|
|
||||||
OperationMode operation;
|
|
||||||
|
|
||||||
// Message to be sent when conditions are met.
|
|
||||||
MARTe::ReferenceT<MARTe::Message> eventMsg;
|
|
||||||
|
|
||||||
// Was the message already sent and we are waiting for a state change before next message can be sent.
|
|
||||||
bool needsReset;
|
|
||||||
|
|
||||||
// Array of expected integer values of input signals.
|
|
||||||
MARTe::uint64* expectedValuesInt;
|
|
||||||
|
|
||||||
// Array of expected float values for input signals.
|
|
||||||
MARTe::float64* expectedValuesFloat;
|
|
||||||
|
|
||||||
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
|
|
||||||
MARTe::uint32 intValuesCount;
|
|
||||||
|
|
||||||
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
|
|
||||||
MARTe::uint32 floatValuesCount;
|
|
||||||
|
|
||||||
// Array of comparators
|
|
||||||
ComparisonMode* comparators;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JAMESSAGEGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAMessageGAM.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
|
|
||||||
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/JAMessageGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAMessageGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAModeControlGAM.cpp
|
|
||||||
* @brief Source file for class JAModeControlGAM
|
|
||||||
* @date Jan, 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 JAModeControlGAM (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 "JAModeControlGAM.h"
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JAModeControlGAM::JAModeControlGAM() {
|
|
||||||
inputSignals = NULL_PTR(MARTe::uint32 **);
|
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
pulseLengthLimit = 360000000u;
|
|
||||||
resetRemainingTime = true;
|
|
||||||
previousState = 0u;
|
|
||||||
}
|
|
||||||
|
|
||||||
JAModeControlGAM::~JAModeControlGAM() {
|
|
||||||
if (inputSignals != NULL_PTR(MARTe::uint32 **)) {
|
|
||||||
delete[] inputSignals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAModeControlGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
/* read hard coded on cfg file parameter values by using key name. */
|
|
||||||
using namespace MARTe;
|
|
||||||
return GAM::Initialise(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAModeControlGAM::Setup() {
|
|
||||||
/* read GAM Input signal */
|
|
||||||
using namespace MARTe;
|
|
||||||
/* read 4 mode bits and 4 shot length limit values */
|
|
||||||
|
|
||||||
bool ok = numberOfInputSignals == 11;
|
|
||||||
if (ok) {
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; (i < numberOfInputSignals) && (ok); i++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, i);
|
|
||||||
ok = inputType == UnsignedInteger32Bit;
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "InputSignel %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Eleven input signals shall be defined.");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = numberOfOutputSignals == 1;
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "One output signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor type = GetSignalType(OutputSignals, 0);
|
|
||||||
ok = type == UnsignedInteger32Bit;
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(OutputSignals, 0, signalName);
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
inputSignals = new uint32*[numberOfInputSignals];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < 11; i++) {
|
|
||||||
inputSignals[i] = reinterpret_cast<uint32 *>(GetInputSignalMemory(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAModeControlGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
*outputSignal = 0u;
|
|
||||||
previousState = 0u;
|
|
||||||
resetRemainingTime = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAModeControlGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
//When RT state goes to RFON state, update the limit.
|
|
||||||
if(previousState == 0u && *inputSignals[8] == 1u && resetRemainingTime) {
|
|
||||||
rfonTime = *inputSignals[9];
|
|
||||||
resetRemainingTime = false;
|
|
||||||
pulseLengthLimit = CalcPulseLengthLimit(inputSignals);
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Pulse Length was set to Limit:%d", pulseLengthLimit);
|
|
||||||
}
|
|
||||||
// Turn on the flag during RFON if the pulse legth over the limit.
|
|
||||||
if ((*inputSignals[9] - rfonTime <= pulseLengthLimit) && (previousState == 1u)) {
|
|
||||||
*outputSignal = 0u;
|
|
||||||
return true;
|
|
||||||
} else if(*inputSignals[9] == 1u){
|
|
||||||
resetRemainingTime = true;
|
|
||||||
*outputSignal = 1u;
|
|
||||||
}
|
|
||||||
|
|
||||||
previousState = *inputSignals[8];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MARTe::uint32 JAModeControlGAM::CalcPulseLengthLimit(MARTe::uint32 **inputSignals) {
|
|
||||||
if (*inputSignals[0] == 1) {
|
|
||||||
return *inputSignals[1];
|
|
||||||
} else if (*inputSignals[2] == 1) {
|
|
||||||
return *inputSignals[3];
|
|
||||||
} else if (*inputSignals[4] == 1) {
|
|
||||||
return *inputSignals[5];
|
|
||||||
} else if (*inputSignals[6] == 1) {
|
|
||||||
return *inputSignals[7];
|
|
||||||
} else {
|
|
||||||
return 3600000000;//us
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAModeControlGAM, "1.0")
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAModeControlGAM.h
|
|
||||||
* @brief Header file for class JAModeControlGAM
|
|
||||||
* @date Jan, 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 header file contains the declaration of the class JAModeControlGAM
|
|
||||||
* 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_JAMODECONTROLGAM_H_
|
|
||||||
#define GAMS_JAMODECONTROLGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that check the pulse lenght limit.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +ModeLimitGAM = {
|
|
||||||
* Class = JAModeControlGAM
|
|
||||||
* InputSignals = {
|
|
||||||
* PLC_MODE1 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MD1_SHOTLEN_LIM = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_MODE2 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MD2_SHOTLEN_LIM = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_MODE3 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MD3_SHOTLEN_LIM = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_MODE4 = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MD4_SHOTLEN_LIM = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* Time = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVInjection = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
* If MODE1 is ON and Time is exceed MD1_SHOTLEN_LIM, MODE_SHOTLEN_FLAG become ON.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JAModeControlGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JAModeControlGAM();
|
|
||||||
|
|
||||||
virtual ~JAModeControlGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
MARTe::uint32 CalcPulseLengthLimit(MARTe::uint32 **inputSignals);
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
MARTe::uint32 **inputSignals;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint32 *outputSignal;
|
|
||||||
|
|
||||||
// Calculated pulse lenght limit.
|
|
||||||
MARTe::uint32 pulseLengthLimit;
|
|
||||||
|
|
||||||
// Amount of time passed per execution cycle.
|
|
||||||
MARTe::uint32 rfonTime;
|
|
||||||
|
|
||||||
// reset flag
|
|
||||||
bool resetRemainingTime;
|
|
||||||
MARTe::uint32 previousState;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JAMODECONTROLGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAModeControlGAM.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
|
|
||||||
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/JAModeControlGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAModeControlGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,460 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAPreProgrammedGAM.cpp
|
|
||||||
* @brief Source file for class JAPreProgrammedGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAPreProgrammedGAM (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 "AdvancedErrorManagement.h"
|
|
||||||
#include "CLASSMETHODREGISTER.h"
|
|
||||||
#include "File.h"
|
|
||||||
#include "JAPreProgrammedGAM.h"
|
|
||||||
#include "MessageI.h"
|
|
||||||
#include "RegisteredMethodsMessageFilter.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// How often output signals are updated.
|
|
||||||
const MARTe::uint32 cycleMs = 10u;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JAPreProgrammedGAM::JAPreProgrammedGAM() :
|
|
||||||
GAM() {
|
|
||||||
using namespace MARTe;
|
|
||||||
filenameSignalIndex = 0u;
|
|
||||||
timeSignal = NULL_PTR(MARTe::int32 *);
|
|
||||||
loadTriggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
fhpsrefSignal = NULL_PTR(MARTe::float32 *);
|
|
||||||
rfonStateSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
valueSignals = NULL_PTR(MARTe::float32 **);
|
|
||||||
preProgrammedValues = NULL_PTR(MARTe::float32 **);
|
|
||||||
preProgrammedTime = NULL_PTR(MARTe::int32 *);
|
|
||||||
fileLoadedSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
fileLoadErrorOutput = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
startTime = 0u;
|
|
||||||
numberOfPreProgrammedValues = 0u;
|
|
||||||
numberOfPreProgrammedTimeRows = 0u;
|
|
||||||
currentRow = 0u;
|
|
||||||
mode = None;
|
|
||||||
preProgrammedExecutaionPeriodMs = 0u;
|
|
||||||
msCounter = 0u;
|
|
||||||
preProgrammedRow = 0u;
|
|
||||||
resetOutputSignals = false;
|
|
||||||
readOnce = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
JAPreProgrammedGAM::~JAPreProgrammedGAM() {
|
|
||||||
DeleteArrays();
|
|
||||||
if (valueSignals != NULL_PTR(MARTe::float32 **)) {
|
|
||||||
delete[] valueSignals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAPreProgrammedGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("Directory", directory);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Directory shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("PreProgrammedPeriodMs", preProgrammedExecutaionPeriodMs);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Directory shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAPreProgrammedGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
//Signal number check.
|
|
||||||
bool ok = (numberOfInputSignals == 4u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals > 2u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "At least two output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Four input signals with the filename and file load trigger shall be defined");
|
|
||||||
}
|
|
||||||
//Input signals type consistency check.
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Filename";
|
|
||||||
ok = GetSignalIndex(InputSignals, filenameSignalIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Filename input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, filenameSignalIndex);
|
|
||||||
ok = (inputType == CharString);
|
|
||||||
if (!ok) {
|
|
||||||
ok = (inputType == Character8Bit);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, filenameSignalIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as string", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "CSV_LOAD";
|
|
||||||
uint32 loadSignalIndex;
|
|
||||||
ok = GetSignalIndex(InputSignals, loadSignalIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "CSV_LOAD input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, loadSignalIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, loadSignalIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
} else {
|
|
||||||
loadTriggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(loadSignalIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "FHPS_REF";
|
|
||||||
uint32 fhpsrefIndex;
|
|
||||||
ok = GetSignalIndex(InputSignals, fhpsrefIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "FHPS_REF input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, fhpsrefIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, fhpsrefIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
|
||||||
} else {
|
|
||||||
fhpsrefSignal = reinterpret_cast<float32 *>(GetInputSignalMemory(fhpsrefIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "RFON";
|
|
||||||
uint32 rfonIndex;
|
|
||||||
ok = GetSignalIndex(InputSignals, rfonIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "RFON input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, rfonIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, rfonIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
|
||||||
} else {
|
|
||||||
rfonStateSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(rfonIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Output signals type check.
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor timeType = GetSignalType(OutputSignals, 0);
|
|
||||||
ok = (timeType == SignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, 0, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as int32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 i;
|
|
||||||
for (i = 1u; (i <= 6) && (ok); i++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, i);
|
|
||||||
ok = (outputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(OutputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor fileLoadedType = GetSignalType(OutputSignals, 7u);
|
|
||||||
ok = (fileLoadedType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(OutputSignals, 6u, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor fileLoadErrorOutputType = GetSignalType(OutputSignals, 8u);
|
|
||||||
ok = (fileLoadErrorOutputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(OutputSignals, 7u, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Register signal memory
|
|
||||||
if (ok) {
|
|
||||||
timeSignal = reinterpret_cast<int32 *>(GetOutputSignalMemory(0));
|
|
||||||
valueSignals = new float32*[6u];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 1u; i <= 6u; i++) {
|
|
||||||
valueSignals[i - 1] = reinterpret_cast<float32 *>(GetOutputSignalMemory(i));
|
|
||||||
}
|
|
||||||
fileLoadedSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7u));
|
|
||||||
fileLoadErrorOutput = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8u));
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAPreProgrammedGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
bool ok = true;
|
|
||||||
if (strcmp(nextStateName, "WaitReady") == 0) {
|
|
||||||
mode = LoadFileMode;
|
|
||||||
resetOutputSignals = true;
|
|
||||||
// Reset read once flag when reentering WaitReady state.
|
|
||||||
readOnce = true;
|
|
||||||
} else if (strcmp(nextStateName, "WaitPermit") == 0) {
|
|
||||||
mode = LoadFileMode;
|
|
||||||
resetOutputSignals = true;
|
|
||||||
currentRow = 0u;
|
|
||||||
} else if (strcmp(nextStateName, "WaitHVON_PREP") == 0 || strcmp(nextStateName, "WaitHVON_SDN_PREP") == 0) {
|
|
||||||
ok = numberOfPreProgrammedTimeRows > 0;
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::IllegalOperation, "Entering PreProgrammed mode without any waveform data.");
|
|
||||||
}
|
|
||||||
mode = PreProgrammedMode;
|
|
||||||
msCounter = cycleMs;
|
|
||||||
currentRow = 0u;
|
|
||||||
} else {
|
|
||||||
mode = None;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAPreProgrammedGAM::LoadFile() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
DeleteArrays();
|
|
||||||
|
|
||||||
bool ok = true;
|
|
||||||
|
|
||||||
const MARTe::char8 * const filenameSignal = reinterpret_cast<const char8 * const >(GetInputSignalMemory(filenameSignalIndex));
|
|
||||||
//Prepare full path to the configuration file.
|
|
||||||
StreamString filename = directory;
|
|
||||||
filename += DIRECTORY_SEPARATOR;
|
|
||||||
filename += filenameSignal;
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::Debug, "Opening file %s", filename.Buffer());
|
|
||||||
|
|
||||||
//parse prepro configuration file into two arrays(time, values).
|
|
||||||
File f;
|
|
||||||
ok = f.Open(filename.Buffer(), BasicFile::ACCESS_MODE_R);
|
|
||||||
if (ok) {
|
|
||||||
//Count up number of file Rows.
|
|
||||||
numberOfPreProgrammedTimeRows = 0u;
|
|
||||||
StreamString tokenLine;
|
|
||||||
while (f.GetLine(tokenLine)) {
|
|
||||||
if (tokenLine[0] != '#' && tokenLine[0] != '-') {
|
|
||||||
numberOfPreProgrammedTimeRows++;
|
|
||||||
}
|
|
||||||
tokenLine = "";
|
|
||||||
}
|
|
||||||
//Count up number of file lines
|
|
||||||
numberOfPreProgrammedValues = 0u;
|
|
||||||
f.Seek(0);
|
|
||||||
uint32 t = 0u;
|
|
||||||
tokenLine = "";
|
|
||||||
while ((ok) && (f.GetLine(tokenLine))) {
|
|
||||||
// Skip comment line and minus time
|
|
||||||
if (tokenLine[0] == '#' || tokenLine[0] == '-') {
|
|
||||||
tokenLine = "";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Prepare two arrays at first.
|
|
||||||
if (numberOfPreProgrammedValues == 0) {
|
|
||||||
StreamString token;
|
|
||||||
char8 ignored;
|
|
||||||
tokenLine.Seek(0);
|
|
||||||
while (tokenLine.GetToken(token, ",", ignored)) {
|
|
||||||
numberOfPreProgrammedValues++;
|
|
||||||
token = "";
|
|
||||||
}
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError,"numberOfPreProgrammedVal %d", numberOfPreProgrammedValues);
|
|
||||||
ok = (numberOfPreProgrammedValues == 7u);//From time row to FHPS row.
|
|
||||||
numberOfPreProgrammedValues -= 1u; //From MHVPS row to FHPS row.
|
|
||||||
if (ok) {
|
|
||||||
preProgrammedTime = new int32[numberOfPreProgrammedTimeRows];
|
|
||||||
preProgrammedValues = new float32*[numberOfPreProgrammedTimeRows];
|
|
||||||
uint32 j;
|
|
||||||
for (j = 0u; j < numberOfPreProgrammedTimeRows; j++) {
|
|
||||||
preProgrammedValues[j] = new float32[numberOfPreProgrammedValues];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError,
|
|
||||||
"Number of columns in csv file (%d) is not consistent with the number of output signals (%d)",
|
|
||||||
numberOfPreProgrammedValues, 6u);
|
|
||||||
*fileLoadErrorOutput = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add loaded data into two arrays.
|
|
||||||
if (ok) {
|
|
||||||
StreamString token;
|
|
||||||
char8 ignored;
|
|
||||||
tokenLine.Seek(0);
|
|
||||||
uint32 idx = 0u;
|
|
||||||
while (tokenLine.GetToken(token, ",", ignored)) {
|
|
||||||
if (idx == 0u) {
|
|
||||||
preProgrammedTime[t] = atoi(token.Buffer());
|
|
||||||
if (t == 0 && preProgrammedTime[0] != 0) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::Debug, "Prepro start from none zero time.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = ((idx - 1) < numberOfPreProgrammedValues);
|
|
||||||
if (ok) {
|
|
||||||
preProgrammedValues[t][idx - 1] = static_cast<float32>(atof(token.Buffer()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::FatalError, "Number of columns in csv file is not consistent with the number of output signals in line %d", t);
|
|
||||||
*fileLoadErrorOutput = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
token = "";
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
t++;
|
|
||||||
}
|
|
||||||
tokenLine = "";
|
|
||||||
}
|
|
||||||
f.Close();
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentRow = 0u;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
numberOfPreProgrammedTimeRows = 0u;
|
|
||||||
REPORT_ERROR(ErrorManagement::Warning, "Failed to read waveform data from file.");
|
|
||||||
*fileLoadErrorOutput = 2;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAPreProgrammedGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = true;
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case LoadFileMode: {
|
|
||||||
if (*loadTriggerSignal == 1u) {
|
|
||||||
if (readOnce) {
|
|
||||||
*fileLoadErrorOutput = 0;
|
|
||||||
*fileLoadedSignal = LoadFile() ? 1 : 0;
|
|
||||||
readOnce = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Reset read once flag when loadTriggerSignal is reset.
|
|
||||||
readOnce = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetOutputSignals) {
|
|
||||||
// Write default values to output signals
|
|
||||||
*timeSignal = 0u;
|
|
||||||
*valueSignals[FHPS-1] = *fhpsrefSignal;
|
|
||||||
resetOutputSignals = false;
|
|
||||||
} else {
|
|
||||||
*valueSignals[FHPS-1] = *fhpsrefSignal; //copy input(2) to val_arr(4)
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case PreProgrammedMode: {
|
|
||||||
ok = numberOfPreProgrammedTimeRows > 0;
|
|
||||||
|
|
||||||
//add 20210105. Before RFON, prepro setpoints should be same as the values listed at csv first line.
|
|
||||||
if (ok && *rfonStateSignal == 0) {
|
|
||||||
uint32 j;
|
|
||||||
for (j = 0u; j < FHPS; j++) {
|
|
||||||
*valueSignals[j] = preProgrammedValues[0][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//end 20210105
|
|
||||||
|
|
||||||
if (ok && currentRow < numberOfPreProgrammedTimeRows && *rfonStateSignal == 1) {
|
|
||||||
if (msCounter >= cycleMs) {
|
|
||||||
msCounter -= cycleMs;
|
|
||||||
int32 currentTime = preProgrammedTime[currentRow];
|
|
||||||
//REPORT_ERROR(MARTe::ErrorManagement::Debug, "Write Time at %d",currentRow);
|
|
||||||
// Write to output signals
|
|
||||||
*timeSignal = currentTime;
|
|
||||||
uint32 j;
|
|
||||||
for (j = 0u; j < FHPS; j++) {
|
|
||||||
*valueSignals[j] = preProgrammedValues[currentRow][j];
|
|
||||||
//REPORT_ERROR(MARTe::ErrorManagement::Debug, "Write Value %f at row %d",preProgrammedValues[currentRow][j], currentRow);
|
|
||||||
}
|
|
||||||
//REPORT_ERROR(MARTe::ErrorManagement::Debug, "Writing pre programmed data for time %d", currentTime);
|
|
||||||
|
|
||||||
// Update row
|
|
||||||
++currentRow;
|
|
||||||
}
|
|
||||||
msCounter += preProgrammedExecutaionPeriodMs;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
default:
|
|
||||||
// Nothing to do.
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::Warning, "Unhandled mode.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JAPreProgrammedGAM::DeleteArrays() {
|
|
||||||
if (preProgrammedValues != NULL_PTR(MARTe::float32 **)) {
|
|
||||||
MARTe::uint32 i;
|
|
||||||
for (i = 0u; i < numberOfPreProgrammedValues; i++) {
|
|
||||||
delete preProgrammedValues[i];
|
|
||||||
}
|
|
||||||
delete[] preProgrammedValues;
|
|
||||||
}
|
|
||||||
if (preProgrammedTime != NULL_PTR(MARTe::int32 *)) {
|
|
||||||
delete[] preProgrammedTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAPreProgrammedGAM, "1.0")
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAPreProgrammedGAM.h
|
|
||||||
* @brief Header file for class JAPreProgrammedGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAPreProgrammedGAM
|
|
||||||
* 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_JAPREPROGRAMMEDGAM_H_
|
|
||||||
#define GAMS_JAPREPROGRAMMEDGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#include "GAM.h"
|
|
||||||
#include "Message.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that update PS output value for pre-programmed operation.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +PreProgrammedGAM = {
|
|
||||||
* Class = JAPreProgrammedGAM
|
|
||||||
* Directory = "../Configurations" // Directory which has pre-pro configuration file.
|
|
||||||
* PreProgrammedPeriodMs = 1 // RFON state is executed every millisecond.
|
|
||||||
* InputSignals = {
|
|
||||||
* CSV_LOAD = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* Filename = {
|
|
||||||
* Alias = CSV_NAME
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* }
|
|
||||||
* FHPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* GYA_PREHEAT_TIME = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = int32
|
|
||||||
* }
|
|
||||||
* MHVPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* BPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* APS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* MCPS_TRG_CURR_SET = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* GCPS_TRG_CURR_SET = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* FHPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* CSV_LOADED = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* CSV_ERR = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JAPreProgrammedGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JAPreProgrammedGAM();
|
|
||||||
|
|
||||||
virtual ~JAPreProgrammedGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
bool LoadFile();
|
|
||||||
|
|
||||||
void DeleteArrays();
|
|
||||||
|
|
||||||
//Parameters
|
|
||||||
MARTe::StreamString directory; //Location for prepro configuration file.
|
|
||||||
MARTe::uint32 preProgrammedExecutaionPeriodMs; // Time between to execution cycles in milliseconds in pre-programmed mode.
|
|
||||||
|
|
||||||
//Input Signals
|
|
||||||
MARTe::uint32 *loadTriggerSignal; //index:0
|
|
||||||
MARTe::uint32 filenameSignalIndex;//index:1
|
|
||||||
MARTe::float32 *fhpsrefSignal; //index:2
|
|
||||||
MARTe::uint32 *rfonStateSignal; //index:3
|
|
||||||
|
|
||||||
//Output Signals
|
|
||||||
MARTe::int32 *timeSignal; //index:0
|
|
||||||
MARTe::float32 **valueSignals; //index:1-5 = BPS,APS,MC,GC,FHPS
|
|
||||||
MARTe::uint32 *fileLoadedSignal; //index:6
|
|
||||||
MARTe::uint32 *fileLoadErrorOutput;//index:7
|
|
||||||
|
|
||||||
//Internal variables
|
|
||||||
MARTe::int32 *preProgrammedTime;
|
|
||||||
MARTe::float32 **preProgrammedValues;
|
|
||||||
|
|
||||||
MARTe::uint32 startTime;
|
|
||||||
|
|
||||||
//Number of columns in csv, EXCLUDING the time
|
|
||||||
MARTe::uint32 numberOfPreProgrammedValues; //is 5.(BPS, APS, MC, GC, FHPS)
|
|
||||||
MARTe::uint32 numberOfPreProgrammedTimeRows; //This start from t=0 row.
|
|
||||||
MARTe::uint32 currentRow;
|
|
||||||
|
|
||||||
// Number of milliseconds since the last time output signals were updated.
|
|
||||||
MARTe::uint32 msCounter;
|
|
||||||
|
|
||||||
// Row number where the pre-programmed data begins (time == 0).
|
|
||||||
MARTe::uint32 preProgrammedRow;
|
|
||||||
|
|
||||||
enum OperationMode {
|
|
||||||
LoadFileMode, PreProgrammedMode, None
|
|
||||||
};
|
|
||||||
enum PreProTableDefinition {
|
|
||||||
Time, MHVPS, BPS, APS, MCPS, GCPS, FHPS
|
|
||||||
};
|
|
||||||
|
|
||||||
OperationMode mode;
|
|
||||||
|
|
||||||
bool resetOutputSignals;
|
|
||||||
|
|
||||||
// Flag determining whether file should be read (so it isn't read multiple time)
|
|
||||||
bool readOnce;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JAPREPROGRAMMEDGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAPreProgrammedGAM.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)/JAPreProgrammedGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAPreProgrammedGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,411 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.cpp
|
|
||||||
* @brief Source file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM (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 "JARTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static MARTe::uint64 getCurrentTimeUs() {
|
|
||||||
using namespace MARTe;
|
|
||||||
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARTStateMachineGAM::JARTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
turn_off_delay = 2000; //us
|
|
||||||
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
short_pulse_mode = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
modulation = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
// write out target.
|
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVArmed = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVInjection = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
|
|
||||||
apsSwonHighResolutionTime = 0;
|
|
||||||
|
|
||||||
aps_hvon_state=0;
|
|
||||||
aps_swon_state=0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARTStateMachineGAM::~JARTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 12u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 16u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined %d",numberOfOutputSignals);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", 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", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
|
||||||
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
|
||||||
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
|
||||||
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
|
||||||
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
|
||||||
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
|
||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
short_pulse_mode = reinterpret_cast<uint32 *>(GetInputSignalMemory(10));
|
|
||||||
modulation = reinterpret_cast<uint32 *>(GetInputSignalMemory(11));
|
|
||||||
|
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
|
||||||
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2));
|
|
||||||
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3));
|
|
||||||
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
|
|
||||||
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
|
||||||
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
|
||||||
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
|
||||||
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
|
||||||
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
|
||||||
|
|
||||||
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(13));
|
|
||||||
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
|
||||||
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(15));
|
|
||||||
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence at %d.", *currentTime);
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
//*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true; bps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true; aps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true; bps_swon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSSWON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputMHVPSON=1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (plcOnTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true; aps_swon_state=1;
|
|
||||||
apsSwonHighResolutionTime = getCurrentTimeUs();
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSSWON=1;
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*shotCounter += 1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
//debug
|
|
||||||
//if((*stopRequest != 0)){
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Stop request was called.!!!");
|
|
||||||
//} else {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset.!!!");
|
|
||||||
//}
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
mhvps_hvon_is_on = false; mhvps_hvon_state=0;
|
|
||||||
aps_hvon_is_on = false; aps_hvon_state=0;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false; bps_hvon_state=0;
|
|
||||||
bps_swon_is_on = false; bps_swon_state=0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
}
|
|
||||||
uint32 updatePeriod = 100; // in microsecnds (get this from Timer)
|
|
||||||
if ((*modePulseLengthLimit == 1u) || (getCurrentTimeUs() + updatePeriod >= (apsSwonHighResolutionTime + *triggerDelay_shotlen))) {
|
|
||||||
|
|
||||||
// Now we do busy wait
|
|
||||||
while (getCurrentTimeUs() < (apsSwonHighResolutionTime + *triggerDelay_shotlen)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "!");
|
|
||||||
}
|
|
||||||
// We stop busy waiting #executionOverhead before expected pulse off time
|
|
||||||
//debug
|
|
||||||
//if((*modePulseLengthLimit == 1u)){
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Mode limit detected.!!!");
|
|
||||||
//} else {
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Shot length reached to the setpoint.!!!");
|
|
||||||
//}
|
|
||||||
//debug end.
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only APS_SWON first.
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 1;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
//In the HVTerminate state, turn APS_SWON off first, and wait 1ms. Finally turn other PS off.
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
*outputRFON = 0;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
aps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset. The State was changed to WaitTrigger at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*short_pulse_mode == 1){
|
|
||||||
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6259 = 1*aps_swon_state;
|
|
||||||
*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 + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
|
|
||||||
}
|
|
||||||
if (modulation) {
|
|
||||||
p4Value = 8*mhvps_hvon_state + 32;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p4Value = 8*mhvps_hvon_state;
|
|
||||||
}
|
|
||||||
//*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
|
|
||||||
*outputSignalNI6528P4 = ~p4Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,262 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.h
|
|
||||||
* @brief Header file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM
|
|
||||||
* 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_JARTSTATEMACHINEGAM_H_
|
|
||||||
#define GAMS_JARTSTATEMACHINEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that provides real-time state machine.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +GAMRealTimeStateMachine = {
|
|
||||||
* Class = JARTStateMachineGAM
|
|
||||||
* ConditionTrigger = 1
|
|
||||||
* mhvps_hvon = 4
|
|
||||||
* aps_hvon = 1
|
|
||||||
* aps_swon = 16
|
|
||||||
* bps_hvon = 2
|
|
||||||
* bps_swon = 8
|
|
||||||
* InputSignals = {
|
|
||||||
* Time = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_ON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MHVPS_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOTLEN = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* StopRequest = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* Value = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* Trigger = 1
|
|
||||||
* }
|
|
||||||
* BEAM_ON_STAT = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVARMED = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVINJECTION = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BeamONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOT_ID = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JARTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JARTStateMachineGAM();
|
|
||||||
|
|
||||||
virtual ~JARTStateMachineGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
enum JARealTimeState {
|
|
||||||
WaitTrigger = 0,
|
|
||||||
SwitchingHVPS = 1,
|
|
||||||
RFON = 2,
|
|
||||||
HVTerminate = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
//The current rtState
|
|
||||||
JARealTimeState currentState;
|
|
||||||
|
|
||||||
//A given condition
|
|
||||||
MARTe::uint32 conditionTrigger;
|
|
||||||
|
|
||||||
//What to output in a given state and condition
|
|
||||||
MARTe::uint32 mhvps_hvon;
|
|
||||||
MARTe::uint32 aps_hvon;
|
|
||||||
MARTe::uint32 aps_swon;
|
|
||||||
MARTe::uint32 bps_hvon;
|
|
||||||
MARTe::uint32 bps_swon;
|
|
||||||
|
|
||||||
//The trigger signal (PLC_ON)
|
|
||||||
MARTe::uint32 *triggerSignal;
|
|
||||||
|
|
||||||
//Time signal
|
|
||||||
MARTe::uint32 *currentTime;
|
|
||||||
|
|
||||||
// Input signals for trigger delay parameters
|
|
||||||
MARTe::uint32 *triggerDelay_mhvps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_shotlen;
|
|
||||||
|
|
||||||
// Input signal for sequence stop request.
|
|
||||||
MARTe::uint32 *stopRequest;
|
|
||||||
// Input signal for pulse length limit by mode.
|
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
|
||||||
// Input signal for short pulse mode.
|
|
||||||
MARTe::uint32 *short_pulse_mode;
|
|
||||||
// Input signal for modulation pv.
|
|
||||||
MARTe::uint32 *modulation;
|
|
||||||
|
|
||||||
// Output signal to which the output value will be written.
|
|
||||||
// One state write One signal.
|
|
||||||
MARTe::uint32 *outputSignal;
|
|
||||||
// state notify output
|
|
||||||
MARTe::uint32 *outputBeamON;
|
|
||||||
MARTe::uint32 *outputHVArmed;
|
|
||||||
MARTe::uint32 *outputHVInjection;
|
|
||||||
MARTe::uint32 *outputRFON;
|
|
||||||
// elapsed time notify output;
|
|
||||||
MARTe::uint32 *outputBeamONTime;
|
|
||||||
MARTe::uint32 *outputRFONTime;
|
|
||||||
// shot counter (coutup every RFON time.)
|
|
||||||
MARTe::uint32 *shotCounter;
|
|
||||||
|
|
||||||
// Added for HVPS state (20201117)
|
|
||||||
MARTe::uint32 *outputAPSHVON;
|
|
||||||
MARTe::uint32 *outputAPSSWON;
|
|
||||||
MARTe::uint32 *outputBPSHVON;
|
|
||||||
MARTe::uint32 *outputBPSSWON;
|
|
||||||
MARTe::uint32 *outputMHVPSON;
|
|
||||||
|
|
||||||
// Output signals for NI devices
|
|
||||||
MARTe::uint32 *outputSignalNI6259;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P3;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P4;
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//Internal Parameters
|
|
||||||
//////////////////////////////
|
|
||||||
//PLC_ON time holder
|
|
||||||
MARTe::uint32 plcOnTime;
|
|
||||||
//APS_SWON time holder
|
|
||||||
MARTe::uint32 apsSwonTime;
|
|
||||||
MARTe::uint32 apsSwoffTime;
|
|
||||||
MARTe::uint64 apsSwonHighResolutionTime;
|
|
||||||
|
|
||||||
//PS turn off delay
|
|
||||||
MARTe::uint32 turn_off_delay;
|
|
||||||
|
|
||||||
//HVPS state holder
|
|
||||||
bool mhvps_hvon_is_on;
|
|
||||||
bool aps_hvon_is_on;
|
|
||||||
bool aps_swon_is_on;
|
|
||||||
bool bps_hvon_is_on;
|
|
||||||
bool bps_swon_is_on;
|
|
||||||
|
|
||||||
// terminal values
|
|
||||||
MARTe::uint8 p3Value;
|
|
||||||
MARTe::uint8 p4Value;
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JARTSTATEMACHINEGAM_H_ */
|
|
||||||
@@ -1,409 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.cpp
|
|
||||||
* @brief Source file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM (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 "JARTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static MARTe::uint64 getCurrentTimeUs() {
|
|
||||||
using namespace MARTe;
|
|
||||||
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARTStateMachineGAM::JARTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
turn_off_delay = 2000; //us
|
|
||||||
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
short_pulse_mode = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
modulation = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
// write out target.
|
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVArmed = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVInjection = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
|
|
||||||
apsSwonHighResolutionTime = 0;
|
|
||||||
|
|
||||||
aps_hvon_state=0;
|
|
||||||
aps_swon_state=0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARTStateMachineGAM::~JARTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 13u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 16u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined %d",numberOfOutputSignals);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", 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", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
|
||||||
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
|
||||||
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
|
||||||
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
|
||||||
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
|
||||||
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
|
||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
short_pulse_mode = reinterpret_cast<uint32 *>(GetInputSignalMemory(10));
|
|
||||||
modulation = reinterpret_cast<uint32 *>(GetInputSignalMemory(11));
|
|
||||||
pauseSet = reinterpret_cast<uint32 *>(GetInputSignalMemory(12));
|
|
||||||
|
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
|
||||||
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2));
|
|
||||||
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3));
|
|
||||||
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
|
|
||||||
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
|
||||||
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
|
||||||
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
|
||||||
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
|
||||||
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
|
||||||
|
|
||||||
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(13));
|
|
||||||
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
|
||||||
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(15));
|
|
||||||
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence at %d.", *currentTime);
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
//*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true; bps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true; aps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true; bps_swon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSSWON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputMHVPSON=1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (plcOnTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true; aps_swon_state=1;
|
|
||||||
apsSwonHighResolutionTime = getCurrentTimeUs();
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSSWON=1;
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*shotCounter += 1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
//debug
|
|
||||||
//if((*stopRequest != 0)){
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Stop request was called.!!!");
|
|
||||||
//} else {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset.!!!");
|
|
||||||
//}
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
mhvps_hvon_is_on = false; mhvps_hvon_state=0;
|
|
||||||
aps_hvon_is_on = false; aps_hvon_state=0;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false; bps_hvon_state=0;
|
|
||||||
bps_swon_is_on = false; bps_swon_state=0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
}
|
|
||||||
uint32 updatePeriod = 100; // in microsecnds (get this from Timer)
|
|
||||||
if ((*modePulseLengthLimit == 1u) || (getCurrentTimeUs() + updatePeriod >= (apsSwonHighResolutionTime + *triggerDelay_shotlen))) {
|
|
||||||
|
|
||||||
// Now we do busy wait
|
|
||||||
while (getCurrentTimeUs() < (apsSwonHighResolutionTime + *triggerDelay_shotlen)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "!");
|
|
||||||
}
|
|
||||||
// We stop busy waiting #executionOverhead before expected pulse off time
|
|
||||||
//debug
|
|
||||||
//if((*modePulseLengthLimit == 1u)){
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Mode limit detected.!!!");
|
|
||||||
//} else {
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Shot length reached to the setpoint.!!!");
|
|
||||||
//}
|
|
||||||
//debug end.
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only APS_SWON first.
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 1;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
//In the HVTerminate state, turn APS_SWON off first, and wait 1ms. Finally turn other PS off.
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
*outputRFON = 0;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
aps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset. The State was changed to WaitTrigger at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*short_pulse_mode == 1){
|
|
||||||
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6259 = 1*aps_swon_state;
|
|
||||||
*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 + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
|
|
||||||
}
|
|
||||||
p4Value = 8*mhvps_hvon_state;
|
|
||||||
if (modulation) p4Value += 32;
|
|
||||||
if (pauseSet) p4Value += 1;
|
|
||||||
//*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
|
|
||||||
*outputSignalNI6528P4 = ~p4Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,264 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.h
|
|
||||||
* @brief Header file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM
|
|
||||||
* 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_JARTSTATEMACHINEGAM_H_
|
|
||||||
#define GAMS_JARTSTATEMACHINEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that provides real-time state machine.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +GAMRealTimeStateMachine = {
|
|
||||||
* Class = JARTStateMachineGAM
|
|
||||||
* ConditionTrigger = 1
|
|
||||||
* mhvps_hvon = 4
|
|
||||||
* aps_hvon = 1
|
|
||||||
* aps_swon = 16
|
|
||||||
* bps_hvon = 2
|
|
||||||
* bps_swon = 8
|
|
||||||
* InputSignals = {
|
|
||||||
* Time = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_ON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MHVPS_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOTLEN = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* StopRequest = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* Value = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* Trigger = 1
|
|
||||||
* }
|
|
||||||
* BEAM_ON_STAT = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVARMED = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVINJECTION = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BeamONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOT_ID = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JARTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JARTStateMachineGAM();
|
|
||||||
|
|
||||||
virtual ~JARTStateMachineGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
enum JARealTimeState {
|
|
||||||
WaitTrigger = 0,
|
|
||||||
SwitchingHVPS = 1,
|
|
||||||
RFON = 2,
|
|
||||||
HVTerminate = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
//The current rtState
|
|
||||||
JARealTimeState currentState;
|
|
||||||
|
|
||||||
//A given condition
|
|
||||||
MARTe::uint32 conditionTrigger;
|
|
||||||
|
|
||||||
//What to output in a given state and condition
|
|
||||||
MARTe::uint32 mhvps_hvon;
|
|
||||||
MARTe::uint32 aps_hvon;
|
|
||||||
MARTe::uint32 aps_swon;
|
|
||||||
MARTe::uint32 bps_hvon;
|
|
||||||
MARTe::uint32 bps_swon;
|
|
||||||
|
|
||||||
//The trigger signal (PLC_ON)
|
|
||||||
MARTe::uint32 *triggerSignal;
|
|
||||||
|
|
||||||
//Time signal
|
|
||||||
MARTe::uint32 *currentTime;
|
|
||||||
|
|
||||||
// Input signals for trigger delay parameters
|
|
||||||
MARTe::uint32 *triggerDelay_mhvps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_shotlen;
|
|
||||||
|
|
||||||
// Input signal for sequence stop request.
|
|
||||||
MARTe::uint32 *stopRequest;
|
|
||||||
// Input signal for pulse length limit by mode.
|
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
|
||||||
// Input signal for short pulse mode.
|
|
||||||
MARTe::uint32 *short_pulse_mode;
|
|
||||||
// Input signal for modulation pv.
|
|
||||||
MARTe::uint32 *modulation;
|
|
||||||
// Input signal for pause signal set pv.
|
|
||||||
MARTe::uint32 *pauseSet;
|
|
||||||
|
|
||||||
// Output signal to which the output value will be written.
|
|
||||||
// One state write One signal.
|
|
||||||
MARTe::uint32 *outputSignal;
|
|
||||||
// state notify output
|
|
||||||
MARTe::uint32 *outputBeamON;
|
|
||||||
MARTe::uint32 *outputHVArmed;
|
|
||||||
MARTe::uint32 *outputHVInjection;
|
|
||||||
MARTe::uint32 *outputRFON;
|
|
||||||
// elapsed time notify output;
|
|
||||||
MARTe::uint32 *outputBeamONTime;
|
|
||||||
MARTe::uint32 *outputRFONTime;
|
|
||||||
// shot counter (coutup every RFON time.)
|
|
||||||
MARTe::uint32 *shotCounter;
|
|
||||||
|
|
||||||
// Added for HVPS state (20201117)
|
|
||||||
MARTe::uint32 *outputAPSHVON;
|
|
||||||
MARTe::uint32 *outputAPSSWON;
|
|
||||||
MARTe::uint32 *outputBPSHVON;
|
|
||||||
MARTe::uint32 *outputBPSSWON;
|
|
||||||
MARTe::uint32 *outputMHVPSON;
|
|
||||||
|
|
||||||
// Output signals for NI devices
|
|
||||||
MARTe::uint32 *outputSignalNI6259;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P3;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P4;
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//Internal Parameters
|
|
||||||
//////////////////////////////
|
|
||||||
//PLC_ON time holder
|
|
||||||
MARTe::uint32 plcOnTime;
|
|
||||||
//APS_SWON time holder
|
|
||||||
MARTe::uint32 apsSwonTime;
|
|
||||||
MARTe::uint32 apsSwoffTime;
|
|
||||||
MARTe::uint64 apsSwonHighResolutionTime;
|
|
||||||
|
|
||||||
//PS turn off delay
|
|
||||||
MARTe::uint32 turn_off_delay;
|
|
||||||
|
|
||||||
//HVPS state holder
|
|
||||||
bool mhvps_hvon_is_on;
|
|
||||||
bool aps_hvon_is_on;
|
|
||||||
bool aps_swon_is_on;
|
|
||||||
bool bps_hvon_is_on;
|
|
||||||
bool bps_swon_is_on;
|
|
||||||
|
|
||||||
// terminal values
|
|
||||||
MARTe::uint8 p3Value;
|
|
||||||
MARTe::uint8 p4Value;
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JARTSTATEMACHINEGAM_H_ */
|
|
||||||
@@ -1,402 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.cpp
|
|
||||||
* @brief Source file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM (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 "JARTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static MARTe::uint64 getCurrentTimeUs() {
|
|
||||||
using namespace MARTe;
|
|
||||||
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARTStateMachineGAM::JARTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
turn_off_delay = 2000; //us
|
|
||||||
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
// write out target.
|
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVArmed = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVInjection = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
|
|
||||||
apsSwonHighResolutionTime = 0;
|
|
||||||
|
|
||||||
aps_hvon_state=0;
|
|
||||||
aps_swon_state=0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARTStateMachineGAM::~JARTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 11u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 16u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined %d",numberOfOutputSignals);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", 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", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
|
||||||
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
|
||||||
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
|
||||||
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
|
||||||
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
|
||||||
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
|
||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
short_pulse_mode = reinterpret_cast<uint32 *>(GetInputSignalMemory(10));
|
|
||||||
|
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
|
||||||
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2));
|
|
||||||
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3));
|
|
||||||
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
|
|
||||||
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
|
||||||
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
|
||||||
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
|
||||||
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
|
||||||
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
|
||||||
|
|
||||||
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(13));
|
|
||||||
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
|
||||||
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(15));
|
|
||||||
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence at %d.", *currentTime);
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
//*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true; bps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true; aps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true; bps_swon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSSWON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputMHVPSON=1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (plcOnTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true; aps_swon_state=1;
|
|
||||||
apsSwonHighResolutionTime = getCurrentTimeUs();
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSSWON=1;
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*shotCounter += 1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
//debug
|
|
||||||
//if((*stopRequest != 0)){
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Stop request was called.!!!");
|
|
||||||
//} else {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset.!!!");
|
|
||||||
//}
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
mhvps_hvon_is_on = false; mhvps_hvon_state=0;
|
|
||||||
aps_hvon_is_on = false; aps_hvon_state=0;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false; bps_hvon_state=0;
|
|
||||||
bps_swon_is_on = false; bps_swon_state=0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
}
|
|
||||||
uint32 updatePeriod = 100; // in microsecnds (get this from Timer)
|
|
||||||
if ((*modePulseLengthLimit == 1u) || (getCurrentTimeUs() + updatePeriod >= (apsSwonHighResolutionTime + *triggerDelay_shotlen))) {
|
|
||||||
|
|
||||||
// Now we do busy wait
|
|
||||||
while (getCurrentTimeUs() < (apsSwonHighResolutionTime + *triggerDelay_shotlen)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "!");
|
|
||||||
}
|
|
||||||
// We stop busy waiting #executionOverhead before expected pulse off time
|
|
||||||
//debug
|
|
||||||
//if((*modePulseLengthLimit == 1u)){
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Mode limit detected.!!!");
|
|
||||||
//} else {
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Shot length reached to the setpoint.!!!");
|
|
||||||
//}
|
|
||||||
//debug end.
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only APS_SWON first.
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 1;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
//In the HVTerminate state, turn APS_SWON off first, and wait 1ms. Finally turn other PS off.
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
*outputRFON = 0;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
aps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset. The State was changed to WaitTrigger at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*short_pulse_mode == 1){
|
|
||||||
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6259 = 1*aps_swon_state;
|
|
||||||
*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 + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
|
|
||||||
}
|
|
||||||
p4Value = 8*mhvps_hvon_state;
|
|
||||||
//*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
|
|
||||||
*outputSignalNI6528P4 = ~p4Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.h
|
|
||||||
* @brief Header file for class JARTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM
|
|
||||||
* 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_JARTSTATEMACHINEGAM_H_
|
|
||||||
#define GAMS_JARTSTATEMACHINEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that provides real-time state machine.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +GAMRealTimeStateMachine = {
|
|
||||||
* Class = JARTStateMachineGAM
|
|
||||||
* ConditionTrigger = 1
|
|
||||||
* mhvps_hvon = 4
|
|
||||||
* aps_hvon = 1
|
|
||||||
* aps_swon = 16
|
|
||||||
* bps_hvon = 2
|
|
||||||
* bps_swon = 8
|
|
||||||
* InputSignals = {
|
|
||||||
* Time = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_ON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MHVPS_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOTLEN = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* StopRequest = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* Value = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* Trigger = 1
|
|
||||||
* }
|
|
||||||
* BEAM_ON_STAT = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVARMED = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVINJECTION = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BeamONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOT_ID = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JARTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JARTStateMachineGAM();
|
|
||||||
|
|
||||||
virtual ~JARTStateMachineGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
enum JARealTimeState {
|
|
||||||
WaitTrigger = 0,
|
|
||||||
SwitchingHVPS = 1,
|
|
||||||
RFON = 2,
|
|
||||||
HVTerminate = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
//The current rtState
|
|
||||||
JARealTimeState currentState;
|
|
||||||
|
|
||||||
//A given condition
|
|
||||||
MARTe::uint32 conditionTrigger;
|
|
||||||
|
|
||||||
//What to output in a given state and condition
|
|
||||||
MARTe::uint32 mhvps_hvon;
|
|
||||||
MARTe::uint32 aps_hvon;
|
|
||||||
MARTe::uint32 aps_swon;
|
|
||||||
MARTe::uint32 bps_hvon;
|
|
||||||
MARTe::uint32 bps_swon;
|
|
||||||
|
|
||||||
//The trigger signal (PLC_ON)
|
|
||||||
MARTe::uint32 *triggerSignal;
|
|
||||||
|
|
||||||
//Time signal
|
|
||||||
MARTe::uint32 *currentTime;
|
|
||||||
|
|
||||||
// Input signals for trigger delay parameters
|
|
||||||
MARTe::uint32 *triggerDelay_mhvps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_shotlen;
|
|
||||||
|
|
||||||
// Input signal for sequence stop request.
|
|
||||||
MARTe::uint32 *stopRequest;
|
|
||||||
// Input signal for pulse length limit by mode.
|
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
|
||||||
// Input signal for short pulse mode.
|
|
||||||
MARTe::uint32 *short_pulse_mode;
|
|
||||||
|
|
||||||
// Output signal to which the output value will be written.
|
|
||||||
// One state write One signal.
|
|
||||||
MARTe::uint32 *outputSignal;
|
|
||||||
// state notify output
|
|
||||||
MARTe::uint32 *outputBeamON;
|
|
||||||
MARTe::uint32 *outputHVArmed;
|
|
||||||
MARTe::uint32 *outputHVInjection;
|
|
||||||
MARTe::uint32 *outputRFON;
|
|
||||||
// elapsed time notify output;
|
|
||||||
MARTe::uint32 *outputBeamONTime;
|
|
||||||
MARTe::uint32 *outputRFONTime;
|
|
||||||
// shot counter (coutup every RFON time.)
|
|
||||||
MARTe::uint32 *shotCounter;
|
|
||||||
|
|
||||||
// Added for HVPS state (20201117)
|
|
||||||
MARTe::uint32 *outputAPSHVON;
|
|
||||||
MARTe::uint32 *outputAPSSWON;
|
|
||||||
MARTe::uint32 *outputBPSHVON;
|
|
||||||
MARTe::uint32 *outputBPSSWON;
|
|
||||||
MARTe::uint32 *outputMHVPSON;
|
|
||||||
|
|
||||||
// Output signals for NI devices
|
|
||||||
MARTe::uint32 *outputSignalNI6259;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P3;
|
|
||||||
MARTe::uint8 *outputSignalNI6528P4;
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//Internal Parameters
|
|
||||||
//////////////////////////////
|
|
||||||
//PLC_ON time holder
|
|
||||||
MARTe::uint32 plcOnTime;
|
|
||||||
//APS_SWON time holder
|
|
||||||
MARTe::uint32 apsSwonTime;
|
|
||||||
MARTe::uint32 apsSwoffTime;
|
|
||||||
MARTe::uint64 apsSwonHighResolutionTime;
|
|
||||||
|
|
||||||
//PS turn off delay
|
|
||||||
MARTe::uint32 turn_off_delay;
|
|
||||||
|
|
||||||
//HVPS state holder
|
|
||||||
bool mhvps_hvon_is_on;
|
|
||||||
bool aps_hvon_is_on;
|
|
||||||
bool aps_swon_is_on;
|
|
||||||
bool bps_hvon_is_on;
|
|
||||||
bool bps_swon_is_on;
|
|
||||||
|
|
||||||
// terminal values
|
|
||||||
MARTe::uint8 p3Value;
|
|
||||||
MARTe::uint8 p4Value;
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JARTSTATEMACHINEGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JARTStateMachineGAM.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)/JARTStateMachineGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JARTStateMachineGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARampupGAM.cpp
|
|
||||||
* @brief Source file for class JARampupGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JARampupGAM (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 "AdvancedErrorManagement.h"
|
|
||||||
#include "JARampupGAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARampupGAM::JARampupGAM() : GAM() {
|
|
||||||
current_setpoint = NULL_PTR(MARTe::float32 *);
|
|
||||||
target_value = NULL_PTR(MARTe::float32 *);
|
|
||||||
rampup_time = NULL_PTR(MARTe::float32 *);
|
|
||||||
start = NULL_PTR(MARTe::uint32 *);
|
|
||||||
standby = NULL_PTR(MARTe::uint32 *);
|
|
||||||
isAuto = NULL_PTR(MARTe::uint32 *);
|
|
||||||
FHPS_PrePro = NULL_PTR(MARTe::float32 *);
|
|
||||||
|
|
||||||
output = NULL_PTR(MARTe::float32 *);
|
|
||||||
state = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
rampup_rate = 0.0f;
|
|
||||||
inRampup = false;
|
|
||||||
resetFlag = true;
|
|
||||||
inWaitHVON = false;
|
|
||||||
inWaitStandby = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARampupGAM::~JARampupGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARampupGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
return GAM::Initialise(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARampupGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 7u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 2u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Two output signals shall be defined.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Six input signals shall be defined.");
|
|
||||||
}
|
|
||||||
uint32 currentspvIndex;
|
|
||||||
uint32 targetvIndex;
|
|
||||||
uint32 timeIndex;
|
|
||||||
uint32 startIndex;
|
|
||||||
uint32 standbyIndex;
|
|
||||||
uint32 isAutoIndex;
|
|
||||||
uint32 fhpsPreProIndex;
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Currspv";
|
|
||||||
ok = GetSignalIndex(InputSignals, currentspvIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Currspv input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, currentspvIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Currspv shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Targetv";
|
|
||||||
ok = GetSignalIndex(InputSignals, targetvIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Targetv input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, targetvIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Targetv shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Time";
|
|
||||||
ok = GetSignalIndex(InputSignals, timeIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Time input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, timeIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Time shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Start";
|
|
||||||
ok = GetSignalIndex(InputSignals, startIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Start input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, startIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Start shall be defined as uint32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "PLC_STANDBY";
|
|
||||||
ok = GetSignalIndex(InputSignals, standbyIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLC_STANDBY input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, standbyIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLC_STANDBY shall be defined as uint32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "MANUAL_AUTO";
|
|
||||||
ok = GetSignalIndex(InputSignals, isAutoIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "MANUAL_AUTO input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, isAutoIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "MANUAL_AUTO shall be defined as uint32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "FHPS_PrePro";
|
|
||||||
ok = GetSignalIndex(InputSignals, fhpsPreProIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "FHPS_PrePro input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, fhpsPreProIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal FHPS_PrePro shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(OutputSignals, 0);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Output shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(OutputSignals, 1);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal state shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
current_setpoint = reinterpret_cast<float32 *>(GetInputSignalMemory(currentspvIndex));
|
|
||||||
target_value = reinterpret_cast<float32 *>(GetInputSignalMemory(targetvIndex));
|
|
||||||
rampup_time = reinterpret_cast<float32 *>(GetInputSignalMemory(timeIndex));
|
|
||||||
start = reinterpret_cast<uint32 *>(GetInputSignalMemory(startIndex));
|
|
||||||
standby = reinterpret_cast<uint32 *>(GetInputSignalMemory(standbyIndex));
|
|
||||||
isAuto = reinterpret_cast<uint32 *>(GetInputSignalMemory(isAutoIndex));
|
|
||||||
FHPS_PrePro = reinterpret_cast<float32 *>(GetInputSignalMemory(fhpsPreProIndex));
|
|
||||||
|
|
||||||
output = reinterpret_cast<float32 *>(GetOutputSignalMemory(0));
|
|
||||||
state = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARampupGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName){
|
|
||||||
if(strcmp(nextStateName, "WaitHVON_PREP")==0 || strcmp(nextStateName, "WaitHVON_SDN_PREP")==0 ||
|
|
||||||
strcmp(nextStateName, "WaitHVON")==0 || strcmp(nextStateName, "WaitHVON_SDN")==0){
|
|
||||||
inWaitHVON = true;
|
|
||||||
inWaitStandby = false;
|
|
||||||
} else{
|
|
||||||
inWaitHVON = false;
|
|
||||||
if(strcmp(nextStateName,"WaitStandby")==0 ){
|
|
||||||
inWaitStandby = true;
|
|
||||||
} else {
|
|
||||||
inWaitStandby = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARampupGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
if(!inWaitHVON){
|
|
||||||
if (*target_value <= 0.0f || *standby == 0u) {
|
|
||||||
*output = 0.0f;
|
|
||||||
rampup_rate = 0.0f;
|
|
||||||
if(*target_value <= 0.0f){
|
|
||||||
*state = 3u;
|
|
||||||
} else {
|
|
||||||
*state = 0u;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(*start == 1u && *isAuto==0u){ //isAuto = 1.Manual, 0.auto-rampup.
|
|
||||||
inRampup = true;
|
|
||||||
resetFlag = true;
|
|
||||||
*output = 0.0f; //Enable if it should start always zero.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcrate new rampup rate.
|
|
||||||
if(*rampup_time != 0 && resetFlag == true){
|
|
||||||
rampup_rate = (*target_value - *current_setpoint) / *rampup_time/1000.0f; // Volt/msec
|
|
||||||
resetFlag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Parameter
|
|
||||||
if(*standby == 1u ){
|
|
||||||
if(*isAuto == 1u){
|
|
||||||
if (inWaitStandby){
|
|
||||||
*output = *target_value;
|
|
||||||
} else{
|
|
||||||
*output = *FHPS_PrePro;
|
|
||||||
}
|
|
||||||
//*output = *target_value;
|
|
||||||
*state = 0u;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (inRampup){
|
|
||||||
if (*output + rampup_rate < *target_value && *rampup_time != 0){
|
|
||||||
*output = *output + rampup_rate;
|
|
||||||
*state = 1u;
|
|
||||||
} else {
|
|
||||||
*output = *target_value;
|
|
||||||
*state = 2u;
|
|
||||||
inRampup = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if(*isAuto == 0){
|
|
||||||
*output = *FHPS_PrePro;
|
|
||||||
} else{
|
|
||||||
*output = *target_value;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARampupGAM, "1.0")
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARampupGAM.h
|
|
||||||
* @brief Header file for class JARampupGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JARampupGAM
|
|
||||||
* 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_JARampupGAM_H_
|
|
||||||
#define GAMS_JARampupGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that rampup output value with specified target value and duration.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +FHPSRampupGAM = {
|
|
||||||
* Class = JARampupGAM
|
|
||||||
* InputSignals = {
|
|
||||||
* Currspv = {
|
|
||||||
* Alias = FHPS_REF
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Targetv = {
|
|
||||||
* Alias = FHPS_AUTO_TAGV
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Time = {
|
|
||||||
* Alias = FHPS_AUTO_TIME
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Start = {
|
|
||||||
* Alias = FHPS_AUTO_START
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* FHPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JARampupGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JARampupGAM();
|
|
||||||
|
|
||||||
virtual ~JARampupGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
// Input signal containing current current_setpoint
|
|
||||||
MARTe::float32 *current_setpoint;
|
|
||||||
|
|
||||||
// Input signal containing the frequency of the waveform.
|
|
||||||
MARTe::float32 *target_value;
|
|
||||||
|
|
||||||
// Input signal containing the amplitude of the waveform.
|
|
||||||
MARTe::float32 *rampup_time;
|
|
||||||
|
|
||||||
// Input signal containing CCPS_ON_REQUEST
|
|
||||||
MARTe::uint32 *start;
|
|
||||||
|
|
||||||
// Input signal PLC_STANDBY
|
|
||||||
MARTe::uint32 *standby;
|
|
||||||
|
|
||||||
// MANUAL AUTO button
|
|
||||||
MARTe::uint32 *isAuto;
|
|
||||||
|
|
||||||
// Input signal
|
|
||||||
MARTe::float32 *FHPS_PrePro;
|
|
||||||
|
|
||||||
// Output
|
|
||||||
MARTe::float32 *output;
|
|
||||||
// State output
|
|
||||||
MARTe::uint32 *state; //0:NotOperation, 1:InOperation, 2:Finish, 3:Error
|
|
||||||
|
|
||||||
// Internal variables
|
|
||||||
MARTe::float32 rampup_rate;
|
|
||||||
bool inRampup;
|
|
||||||
bool resetFlag;
|
|
||||||
bool inWaitHVON;
|
|
||||||
bool inWaitStandby;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JARampupGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JARampupGAM.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)/JARampupGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JARampupGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JASDNRTStateMachineGAM.cpp
|
|
||||||
* @brief Source file for class JASDNRTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JASDNRTStateMachineGAM (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 "JASDNRTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
sdnTriggerTime = 0;
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
sdnCommand = NULL_PTR(MARTe::uint16 *);
|
|
||||||
|
|
||||||
// write out target.
|
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVArmed = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputHVInjection = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFON = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
JASDNRTStateMachineGAM::~JASDNRTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASDNRTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 11u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 8u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven 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 == UnsignedInteger16Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or uint16", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = (outputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
|
||||||
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
|
||||||
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
|
||||||
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
|
||||||
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
|
||||||
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
|
||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
|
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
|
||||||
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2));
|
|
||||||
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3));
|
|
||||||
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence in SDN mode.");
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS_HVON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS_HVON) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal.");
|
|
||||||
}
|
|
||||||
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
currentState = WaitSDNTrigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (currentState == WaitSDNTrigger) {
|
|
||||||
|
|
||||||
// Action in this state
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
|
|
||||||
// State change conditions
|
|
||||||
if (*sdnCommand == 1){
|
|
||||||
sdnTriggerTime = *currentTime;
|
|
||||||
currentState = SwitchingHVPS_SWON;
|
|
||||||
}
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS_SWON) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true;
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*shotCounter += 1;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//SDN command processing.
|
|
||||||
if (*sdnCommand == 4 && aps_swon_is_on) {
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 4");
|
|
||||||
}
|
|
||||||
if (*sdnCommand == 3 && !aps_swon_is_on) {
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 3");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if ((*sdnCommand == 2) || (*modePulseLengthLimit == 1u) || (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen))) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "shotlen: %d", *triggerDelay_shotlen);
|
|
||||||
if (*sdnCommand == 2) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "sdn command was 2");
|
|
||||||
} else if (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen)){
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "pulse length reached setpoint.");
|
|
||||||
}
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only aps_swon
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
*outputRFON = 1;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to WaitTrigger");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JASDNRTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.h
|
|
||||||
* @brief Header file for class JASDNRTStateMachineGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JARTStateMachineGAM
|
|
||||||
* 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_JASDNRTSTATEMACHINEGAM_H_
|
|
||||||
#define GAMS_JASDNRTSTATEMACHINEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM provides real-time state machine that communicate with SDN packet.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +GAMSDNRealTimeStateMachine = {
|
|
||||||
* Class = JASDNRTStateMachineGAM
|
|
||||||
* ConditionTrigger = 1
|
|
||||||
* mhvps_hvon = 4
|
|
||||||
* aps_hvon = 1
|
|
||||||
* aps_swon = 16
|
|
||||||
* bps_hvon = 2
|
|
||||||
* bps_swon = 8
|
|
||||||
* InputSignals = {
|
|
||||||
* Time = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* PLC_ON = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MHVPS_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* APS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_HVON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BPS_SWON_DT = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOTLEN = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* StopRequest = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* MODE_SHOTLEN_FLAG = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* Command = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint16
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* Value = {
|
|
||||||
* //DataSource = NI6259
|
|
||||||
* DataSource = Display
|
|
||||||
* Type = uint32
|
|
||||||
* Trigger = 1
|
|
||||||
* }
|
|
||||||
* BeamON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVARMED = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* HVINJECTION = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFON = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* BeamONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* RFONTime = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* SHOT_ID = {
|
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JASDNRTStateMachineGAM();
|
|
||||||
|
|
||||||
virtual ~JASDNRTStateMachineGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
enum JARealTimeState {
|
|
||||||
WaitTrigger = 0,
|
|
||||||
SwitchingHVPS_HVON = 1,
|
|
||||||
WaitSDNTrigger = 2,
|
|
||||||
SwitchingHVPS_SWON = 3,
|
|
||||||
RFON = 4,
|
|
||||||
HVTerminate = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
//The current rtState
|
|
||||||
JARealTimeState currentState;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
// Static parameter given by cfg File
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
//A given condition
|
|
||||||
MARTe::uint32 conditionTrigger;
|
|
||||||
//What to output in a given state and condition
|
|
||||||
MARTe::uint32 mhvps_hvon;
|
|
||||||
MARTe::uint32 aps_hvon;
|
|
||||||
MARTe::uint32 aps_swon;
|
|
||||||
MARTe::uint32 bps_hvon;
|
|
||||||
MARTe::uint32 bps_swon;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
// Input signals
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
//The trigger signal (PLC_ON)
|
|
||||||
MARTe::uint32 *triggerSignal;
|
|
||||||
//Time signal (Time from TimerGAM)
|
|
||||||
MARTe::uint32 *currentTime;
|
|
||||||
// Input signals for trigger delay parameters
|
|
||||||
MARTe::uint32 *triggerDelay_mhvps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_aps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_hvon;
|
|
||||||
MARTe::uint32 *triggerDelay_bps_swon;
|
|
||||||
MARTe::uint32 *triggerDelay_shotlen;
|
|
||||||
// Input signal for sequence stop request.
|
|
||||||
MARTe::uint32 *stopRequest;
|
|
||||||
// Input signal for pulse length limit by mode.
|
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
|
||||||
// Input signal for SDN commands.
|
|
||||||
MARTe::uint16 *sdnCommand;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
|
||||||
// Output signal to which the output value will be written.
|
|
||||||
/////////////////////////////////////////////////////////////
|
|
||||||
// One state write One signal.
|
|
||||||
MARTe::uint32 *outputSignal;
|
|
||||||
// state notify output
|
|
||||||
MARTe::uint32 *outputBeamON;
|
|
||||||
MARTe::uint32 *outputHVArmed;
|
|
||||||
MARTe::uint32 *outputHVInjection;
|
|
||||||
MARTe::uint32 *outputRFON;
|
|
||||||
// elapsed time notify output;
|
|
||||||
MARTe::uint32 *outputBeamONTime;
|
|
||||||
MARTe::uint32 *outputRFONTime;
|
|
||||||
// shot counter (coutup every RFON time.)
|
|
||||||
MARTe::uint32 *shotCounter;
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//Internal Parameters
|
|
||||||
//////////////////////////////
|
|
||||||
//PLC_ON time holder
|
|
||||||
MARTe::uint32 plcOnTime;
|
|
||||||
//APS_SWON time holder
|
|
||||||
MARTe::uint32 apsSwonTime;
|
|
||||||
MARTe::uint32 apsSwoffTime;
|
|
||||||
|
|
||||||
//PS turn off delay
|
|
||||||
MARTe::uint32 turn_off_delay;
|
|
||||||
|
|
||||||
//SDN trigger command arrival time.
|
|
||||||
MARTe::uint32 sdnTriggerTime;
|
|
||||||
//HVPS state holder
|
|
||||||
bool mhvps_hvon_is_on;
|
|
||||||
bool aps_hvon_is_on;
|
|
||||||
bool aps_swon_is_on;
|
|
||||||
bool bps_hvon_is_on;
|
|
||||||
bool bps_swon_is_on;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JASDNRTSTATEMACHINEGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JASDNRTStateMachineGAM.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)/JASDNRTStateMachineGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JASDNRTStateMachineGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JASampleGAM.cpp
|
|
||||||
* @brief Source file for class JASampleGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JASampleGAM (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 "JASampleGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JASampleGAM::JASampleGAM() {
|
|
||||||
// initialize member variables.
|
|
||||||
param1 = 0;
|
|
||||||
param2 = 0;
|
|
||||||
|
|
||||||
//Input signals.
|
|
||||||
input1 = NULL_PTR(MARTe::uint32 *);
|
|
||||||
input2 = NULL_PTR(MARTe::float32 *);
|
|
||||||
//Output signals.
|
|
||||||
output1= NULL_PTR(MARTe::uint32 *);
|
|
||||||
output2 = NULL_PTR(MARTe::float32 *);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JASampleGAM::~JASampleGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASampleGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
//GAM parameters are initialized.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("param1", param1);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The param1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("param2", param2);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The param2 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASampleGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
//This method changes internal parameter based on next realtime state.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASampleGAM::Setup() {
|
|
||||||
// Setup memory for input/output signals on the GAM.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 2u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 2u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Two output signals shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Two input signals shall be defined");
|
|
||||||
}
|
|
||||||
// Do type check for input signals.
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
ok = ((inputType == UnsignedInteger32Bit) || (inputType == Float32Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or flaot32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type check for output signals
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = ((outputType == UnsignedInteger32Bit) || (outputType == Float32Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or float32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal id can get by signal name in configuration file
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "InputXXX"; //Variable name in configuration file.
|
|
||||||
uint32 signalxxxIndex; //Index is copied to this variable by using signal name.
|
|
||||||
ok = GetSignalIndex(InputSignals, signalxxxIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "InputXXX input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, signalxxxIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, signalxxxIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
|
||||||
} else {
|
|
||||||
inputXXX = reinterpret_cast<float32 *>(GetInputSignalMemory(signalxxxIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do type cast. with explicit signal id.
|
|
||||||
if (ok) {
|
|
||||||
input1 = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
input2 = reinterpret_cast<float32 *>(GetInputSignalMemory(1));
|
|
||||||
|
|
||||||
output1 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
|
||||||
output2 = reinterpret_cast<float32 *>(GetOutputSignalMemory(1));
|
|
||||||
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASampleGAM::Execute() {
|
|
||||||
// This method is called every realtime state thread cycle.
|
|
||||||
using namespace MARTe;
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "input1 is %d.", *input1);
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "input2 is %f.", *input2);
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "inputXXX is %f.", *inputXXX);
|
|
||||||
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "maltiply param value to input.");
|
|
||||||
|
|
||||||
*output1 = *input1 * param1;
|
|
||||||
*output2 = *input2 * param2;
|
|
||||||
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "output1 is %d.", *output1);
|
|
||||||
REPORT_ERROR(ErrorManagement::Information, "output2 is %f.", *output2);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JASampleGAM, "1.0")
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JASampleGAM.h
|
|
||||||
* @brief Header file for class JASampleGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JASampleGAM
|
|
||||||
* 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_JASampleGAM_H_
|
|
||||||
#define GAMS_JASampleGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @brief GAM Sample Usage.
|
|
||||||
* @details Sample
|
|
||||||
*
|
|
||||||
* The configuration syntax is:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* +SampleGAM = {
|
|
||||||
* Class = JASampleGAM
|
|
||||||
* InputSignals = {
|
|
||||||
* Input1 = {
|
|
||||||
* DataSource = "DDB"
|
|
||||||
* Type = uint32
|
|
||||||
* Default = 0
|
|
||||||
* }
|
|
||||||
* Input2 = {
|
|
||||||
* DataSource = "DDB"
|
|
||||||
* Type = float32
|
|
||||||
* Default = 100
|
|
||||||
* }
|
|
||||||
* InputXXX = {
|
|
||||||
* DataSource = "DDB"
|
|
||||||
* Type = float32
|
|
||||||
* NumberOfElements = 1
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* Output1 = {
|
|
||||||
* DataSource = "DDB"
|
|
||||||
* Type = uint32
|
|
||||||
* Default = 0
|
|
||||||
* }
|
|
||||||
* Output2 = {
|
|
||||||
* DataSource = "DDB"
|
|
||||||
* Type = int32
|
|
||||||
* Default = 100
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
class JASampleGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JASampleGAM();
|
|
||||||
|
|
||||||
virtual ~JASampleGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//GAM fixed parameters.
|
|
||||||
MARTe::uint32 param1;
|
|
||||||
MARTe::float32 param2;
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
MARTe::uint32 *input1;
|
|
||||||
MARTe::float32 *input2;
|
|
||||||
MARTe::float32 *inputXXX;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
MARTe::uint32 *output1;
|
|
||||||
MARTe::float32 *output2;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JASampleGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JARTSampleGAM.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)/JARTSampleGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JARTSampleGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JASourceChoiseGAM.cpp
|
|
||||||
* @brief Source file for class JASourceChoiseGAM
|
|
||||||
* @date Nov 26, 2018
|
|
||||||
* @author aneto
|
|
||||||
*
|
|
||||||
* @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 JASourceChoiseGAM (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 "JASourceChoiseGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JASourceChoiseGAM::JASourceChoiseGAM() {
|
|
||||||
// initialize member variables.
|
|
||||||
numberOfPVs = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JASourceChoiseGAM::~JASourceChoiseGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
//GAM parameters are initialized.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("numberOfPVs", numberOfPVs);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The numberOfPVs parameter shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASourceChoiseGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
//This method changes internal parameter based on next realtime state.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Setup() {
|
|
||||||
// Setup memory for input/output signals on the GAM.
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == numberOfPVs*3u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == numberOfPVs);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "%d *3 output signals shall be defined", numberOfPVs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "%d input signals shall be defined", numberOfPVs);
|
|
||||||
}
|
|
||||||
// Do type check for input signals.
|
|
||||||
int int_num = 0;
|
|
||||||
int float_num = 0;
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
if(inputType == UnsignedInteger32Bit){
|
|
||||||
int_num++;
|
|
||||||
} else if (inputType == Float32Bit) {
|
|
||||||
float_num++;
|
|
||||||
} else {
|
|
||||||
ok = false;
|
|
||||||
};
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or flaot32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do type check for output signals
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = ((outputType == UnsignedInteger32Bit) || (outputType == Float32Bit));
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or float32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Set memory
|
|
||||||
inputUInt32.resize(numberOfPVs*2);
|
|
||||||
inputFloat32.resize(numberOfPVs*2);
|
|
||||||
choise.resize(numberOfPVs);
|
|
||||||
outputUInt32.resize(numberOfPVs);
|
|
||||||
outputFloat32.resize(numberOfPVs);
|
|
||||||
|
|
||||||
prevUInt32.resize(numberOfPVs*2);
|
|
||||||
prevFloat32.resize(numberOfPVs*2);
|
|
||||||
|
|
||||||
if(ok){
|
|
||||||
for(uint32 i=0; i<numberOfPVs; i++){ //Expected inp1, inp2, choise order in signal list.
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, i*3);
|
|
||||||
if(inputType == UnsignedInteger32Bit){
|
|
||||||
inputUInt32[2*i] = reinterpret_cast<uint32 *>(GetInputSignalMemory(3*i));
|
|
||||||
inputUInt32[2*i+1] = reinterpret_cast<uint32 *>(GetInputSignalMemory(3*i+1));
|
|
||||||
choise[i] = reinterpret_cast<uint32 *>(GetInputSignalMemory(3*i+2));
|
|
||||||
outputUInt32[i] = reinterpret_cast<uint32 *>(GetOutputSignalMemory(i));
|
|
||||||
} else if(inputType == Float32Bit){
|
|
||||||
inputFloat32[2*i] = reinterpret_cast<float *>(GetInputSignalMemory(3*i));
|
|
||||||
inputFloat32[2*i+1] = reinterpret_cast<float *>(GetInputSignalMemory(3*i+1));
|
|
||||||
choise[i] = reinterpret_cast<uint32 *>(GetInputSignalMemory(3*i+2));
|
|
||||||
outputFloat32[i] = reinterpret_cast<float32 *>(GetOutputSignalMemory(i));
|
|
||||||
}
|
|
||||||
prevUInt32[2*i] = 0;
|
|
||||||
prevUInt32[2*i+1] = 0;
|
|
||||||
prevFloat32[2*i] = 0;
|
|
||||||
prevFloat32[2*i+1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JASourceChoiseGAM::Execute() {
|
|
||||||
// This method is called every realtime state thread cycle.
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
for (uint32 i=0; i < numberOfPVs; i++){
|
|
||||||
if(*choise[i]==0){
|
|
||||||
if(outputUInt32[i]){
|
|
||||||
if(prevUInt32[i*2] != *inputUInt32[i*2]){
|
|
||||||
*outputUInt32[i] = *inputUInt32[i*2];
|
|
||||||
prevUInt32[i*2] = *inputUInt32[i*2];
|
|
||||||
prevUInt32[1+i*2] = *inputUInt32[1+i*2];
|
|
||||||
}
|
|
||||||
} else if(outputFloat32[i]){
|
|
||||||
if(prevFloat32[i*2] != *inputFloat32[i*2]){
|
|
||||||
*outputFloat32[i] = *inputFloat32[i*2];
|
|
||||||
prevFloat32[i*2] = *inputFloat32[i*2];
|
|
||||||
prevFloat32[1+i*2] = *inputFloat32[1+i*2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(outputUInt32[i]){
|
|
||||||
if(prevUInt32[1+i*2] != *inputUInt32[1+i*2]){
|
|
||||||
*outputUInt32[i] = *inputUInt32[1+i*2];
|
|
||||||
prevUInt32[i*2] = *inputUInt32[i*2];
|
|
||||||
prevUInt32[1+i*2] = *inputUInt32[1+i*2];
|
|
||||||
}
|
|
||||||
} else if (outputFloat32[i]){
|
|
||||||
if(prevFloat32[1+i*2] != *inputFloat32[1+i*2]){
|
|
||||||
*outputFloat32[i] = *inputFloat32[1+i*2];
|
|
||||||
prevFloat32[i*2] = *inputFloat32[i*2];
|
|
||||||
prevFloat32[1+i*2] = *inputFloat32[1+i*2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JASourceChoiseGAM, "1.0")
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JASourceChoiseGAM.h
|
|
||||||
* @brief Header file for class JASourceChoiseGAM
|
|
||||||
* @date Mar 04, 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 header file contains the declaration of the class JASourceChoiseGAM
|
|
||||||
* 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_JASourceChoiseGAM_H_
|
|
||||||
#define GAMS_JASourceChoiseGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
#include <vector>
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class JASourceChoiseGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JASourceChoiseGAM();
|
|
||||||
|
|
||||||
virtual ~JASourceChoiseGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
//The list of possible states
|
|
||||||
//GAM fixed parameters.
|
|
||||||
MARTe::uint32 numberOfPVs;
|
|
||||||
|
|
||||||
// Input signals
|
|
||||||
std::vector<MARTe::uint32 *> inputUInt32;
|
|
||||||
std::vector<MARTe::float32 *> inputFloat32;
|
|
||||||
std::vector<MARTe::uint32 *> choise;
|
|
||||||
|
|
||||||
// Output signals
|
|
||||||
std::vector<MARTe::uint32 *> outputUInt32;
|
|
||||||
std::vector<MARTe::float32 *> outputFloat32;
|
|
||||||
|
|
||||||
// Previous Input value
|
|
||||||
std::vector<MARTe::uint32> prevUInt32;
|
|
||||||
std::vector<MARTe::float32> prevFloat32;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JASourceChoiseGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JASourceChoiseGAM.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)/JASourceChoiseGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JASourceChoiseGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1,206 +0,0 @@
|
|||||||
/**
|
|
||||||
* @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")
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
/**
|
|
||||||
* @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_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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)
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JATriangleWaveGAM.cpp
|
|
||||||
* @brief Source file for class JATriangleWaveGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JATriangleWaveGAM (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 "AdvancedErrorManagement.h"
|
|
||||||
#include "JATriangleWaveGAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
MARTe::float32 absFloat(MARTe::float32 x) {
|
|
||||||
if (x < 0.0f) {
|
|
||||||
return -x;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
JATriangleWaveGAM::JATriangleWaveGAM() {
|
|
||||||
frequency = NULL_PTR(MARTe::float32 *);
|
|
||||||
amplitude = NULL_PTR(MARTe::float32 *);
|
|
||||||
offset = NULL_PTR(MARTe::float32 *);
|
|
||||||
plcStandby = NULL_PTR(MARTe::uint32 *);
|
|
||||||
waveOutput = NULL_PTR(MARTe::float32 *);
|
|
||||||
time = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
JATriangleWaveGAM::~JATriangleWaveGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JATriangleWaveGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
return GAM::Initialise(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JATriangleWaveGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 4u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "One output signal shall be defined.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Four input signals shall be defined.");
|
|
||||||
}
|
|
||||||
uint32 freqIndex;
|
|
||||||
uint32 ampIndex;
|
|
||||||
uint32 offsetIndex;
|
|
||||||
uint32 plcStandbyIndex;
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Frequency";
|
|
||||||
ok = GetSignalIndex(InputSignals, freqIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Frequency input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, freqIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Frequency shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Amplitude";
|
|
||||||
ok = GetSignalIndex(InputSignals, ampIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Amplitude input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, ampIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Amplitude shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Offset";
|
|
||||||
ok = GetSignalIndex(InputSignals, offsetIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Offset input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, offsetIndex);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Offset shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "PLCSTANDBY";
|
|
||||||
ok = GetSignalIndex(InputSignals, plcStandbyIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLCSTANDBY input signal shall be defined.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, plcStandbyIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLCSTANDBY shall be defined as uint32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(OutputSignals, 0);
|
|
||||||
ok = (inputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Amplitude shall be defined as float32.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
frequency = reinterpret_cast<float32 *>(GetInputSignalMemory(freqIndex));
|
|
||||||
amplitude = reinterpret_cast<float32 *>(GetInputSignalMemory(ampIndex));
|
|
||||||
offset = reinterpret_cast<float32 *>(GetInputSignalMemory(offsetIndex));
|
|
||||||
plcStandby = reinterpret_cast<uint32 *>(GetInputSignalMemory(plcStandbyIndex));
|
|
||||||
waveOutput = reinterpret_cast<float32 *>(GetOutputSignalMemory(0));
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JATriangleWaveGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
// If frequency is not set, output 0.
|
|
||||||
if (*frequency <= 0.0f || *plcStandby == 0u) {
|
|
||||||
*waveOutput = 0.0f;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Increase the current time.
|
|
||||||
++time;
|
|
||||||
// Calculate the period in milliseconds
|
|
||||||
float32 periodMs = 1000.0 / *frequency;
|
|
||||||
// Make sure the time is on [0, periodMs] interval.
|
|
||||||
while (time > periodMs) {
|
|
||||||
time -= periodMs;
|
|
||||||
}
|
|
||||||
// Formula:
|
|
||||||
// f(x) = |x - 0.5| * 2 * amplitude
|
|
||||||
// where x is between 0 and 1
|
|
||||||
*waveOutput = absFloat((time / periodMs) - 0.5f) * 2.0f * (*amplitude) + *offset;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JATriangleWaveGAM, "1.0")
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JATriangleWaveGAM.h
|
|
||||||
* @brief Header file for class JATriangleWaveGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JATriangleWaveGAM
|
|
||||||
* 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_JATRIANGLEWAVEGAM_H_
|
|
||||||
#define GAMS_JATRIANGLEWAVEGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM provides triangular waveform output within 1kHz thread.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +CCPSWaveformGAM = {
|
|
||||||
* Class = JATriangleWaveGAM
|
|
||||||
* InputSignals = {
|
|
||||||
* Offset = {
|
|
||||||
* Alias = OFFSET
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Frequency = {
|
|
||||||
* Alias = CCPS_OUTPUT_FREQ
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* Amplitude = {
|
|
||||||
* Alias = CCPS_OUTPUT_AMP
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* PLCCCPSON = {
|
|
||||||
* Alias = PLC_CCPSON
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* READY = {
|
|
||||||
* Alias = PLC_READY
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* CCPS_REF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* Type = float32
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JATriangleWaveGAM : public MARTe::GAM {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JATriangleWaveGAM();
|
|
||||||
|
|
||||||
virtual ~JATriangleWaveGAM();
|
|
||||||
|
|
||||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
|
||||||
|
|
||||||
virtual bool Setup();
|
|
||||||
|
|
||||||
virtual bool Execute();
|
|
||||||
private:
|
|
||||||
// Input signal containing the frequency of the waveform.
|
|
||||||
MARTe::float32 *frequency;
|
|
||||||
|
|
||||||
// Input signal containing the amplitude of the waveform.
|
|
||||||
MARTe::float32 *amplitude;
|
|
||||||
|
|
||||||
// Input signal cantaining the offset of the waveform.
|
|
||||||
MARTe::float32 *offset;
|
|
||||||
|
|
||||||
// Input signal containing CCPS_ON_REQUEST
|
|
||||||
//MARTe::uint32 *plcccpson;
|
|
||||||
|
|
||||||
// Input signal condition CCPS_READY
|
|
||||||
//MARTe::uint32 *plcReady;
|
|
||||||
|
|
||||||
// Input signal condition CCPS_STANDBY
|
|
||||||
MARTe::uint32 *plcStandby;
|
|
||||||
|
|
||||||
MARTe::float32 *waveOutput;
|
|
||||||
|
|
||||||
MARTe::float32 time;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JATRIANGLEWAVEGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JATriangleWaveGAM.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)/JATriangleWaveGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JATriangleWaveGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,317 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAWFRecordGAM.cpp
|
|
||||||
* @brief Source file for class JAWFRecordGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAWFRecordGAM (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 "JAWFRecordGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
#include "CLASSMETHODREGISTER.h"
|
|
||||||
#include "File.h"
|
|
||||||
#include "MessageI.h"
|
|
||||||
#include "RegisteredMethodsMessageFilter.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// How often output signals are updated.
|
|
||||||
const MARTe::uint32 cycleMs = 10u;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JAWFRecordGAM::JAWFRecordGAM() :
|
|
||||||
GAM() {
|
|
||||||
filenameSignalIndex = 0u;
|
|
||||||
timeSignal = NULL_PTR(MARTe::int32 *);
|
|
||||||
loadTriggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
valueSignals = NULL_PTR(MARTe::float32 **);
|
|
||||||
maxElements = 0u;
|
|
||||||
readOnce = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
JAWFRecordGAM::~JAWFRecordGAM() {
|
|
||||||
if (valueSignals != NULL_PTR(MARTe::float32 **)) {
|
|
||||||
delete[] valueSignals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAWFRecordGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("Directory", directory);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Directory shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAWFRecordGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 2u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals > 1u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "At least two output signal shall be defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Two input signal with the filename and file load trigger shall be defined");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "Filename";
|
|
||||||
ok = GetSignalIndex(InputSignals, filenameSignalIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Filename input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, filenameSignalIndex);
|
|
||||||
ok = (inputType == CharString);
|
|
||||||
if (!ok) {
|
|
||||||
ok = (inputType == Character8Bit);
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, filenameSignalIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as string", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString signalName = "CSV_LOAD";
|
|
||||||
uint32 loadSignalIndex;
|
|
||||||
ok = GetSignalIndex(InputSignals, loadSignalIndex, signalName.Buffer());
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "CSV_LOAD input signal shall be defined");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, loadSignalIndex);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, loadSignalIndex, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
} else {
|
|
||||||
loadTriggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(loadSignalIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
TypeDescriptor timeType = GetSignalType(OutputSignals, 0);
|
|
||||||
|
|
||||||
ok = (timeType == SignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, 0, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as int32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 i;
|
|
||||||
for (i = 1u; (i < numberOfOutputSignals) && (ok); i++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, i);
|
|
||||||
ok = (outputType == Float32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(OutputSignals, i, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uint32 dimentionsCount;
|
|
||||||
ok = GetSignalNumberOfDimensions(OutputSignals, 0u, dimentionsCount);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Output signals shall have 1 dimension.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uint32 elementsCount;
|
|
||||||
ok = GetSignalNumberOfElements(OutputSignals, 0u, elementsCount);
|
|
||||||
if (maxElements == 0) {
|
|
||||||
maxElements = elementsCount;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = (maxElements == elementsCount);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Output signals shall have consistent number of elements.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
valueSignals = new float32*[numberOfOutputSignals - 1u];
|
|
||||||
uint32 i;
|
|
||||||
for (i = 1u; i < numberOfOutputSignals; i++) {
|
|
||||||
valueSignals[i - 1] = reinterpret_cast<float32 *>(GetOutputSignalMemory(i));
|
|
||||||
}
|
|
||||||
timeSignal = reinterpret_cast<int32 *>(GetOutputSignalMemory(0));
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAWFRecordGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
if (strcmp(nextStateName, "WaitReady") == 0) {
|
|
||||||
// Reset read once flag when reentering WaitReady state.
|
|
||||||
readOnce = true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JAWFRecordGAM::LoadFile() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
bool ok = true;
|
|
||||||
|
|
||||||
const char8 * const filenameSignal = reinterpret_cast<const char8 * const >(GetInputSignalMemory(filenameSignalIndex));
|
|
||||||
StreamString filename = directory;
|
|
||||||
filename += DIRECTORY_SEPARATOR;
|
|
||||||
filename += filenameSignal;
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Opening file %s", filename.Buffer());
|
|
||||||
|
|
||||||
File f;
|
|
||||||
ok = f.Open(filename.Buffer(), BasicFile::ACCESS_MODE_R);
|
|
||||||
|
|
||||||
uint32 numberOfPreProgrammedTimeRows = 0u;
|
|
||||||
int32 *preProgrammedTime;
|
|
||||||
float32 **preProgrammedValues;
|
|
||||||
uint32 numberOfPreProgrammedValues = 0u;
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
StreamString tokenLine;
|
|
||||||
while (f.GetLine(tokenLine)) {
|
|
||||||
if (tokenLine[0] != '#') {
|
|
||||||
numberOfPreProgrammedTimeRows++;
|
|
||||||
}
|
|
||||||
tokenLine = "";
|
|
||||||
}
|
|
||||||
f.Seek(0);
|
|
||||||
uint32 t = 0u;
|
|
||||||
tokenLine = "";
|
|
||||||
while ((ok) && (f.GetLine(tokenLine))) {
|
|
||||||
if (tokenLine[0] == '#') {
|
|
||||||
tokenLine = "";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (numberOfPreProgrammedValues == 0) {
|
|
||||||
StreamString token;
|
|
||||||
char8 ignored;
|
|
||||||
tokenLine.Seek(0);
|
|
||||||
while (tokenLine.GetToken(token, ",", ignored)) {
|
|
||||||
numberOfPreProgrammedValues++;
|
|
||||||
token = "";
|
|
||||||
}
|
|
||||||
ok = numberOfPreProgrammedValues == numberOfOutputSignals;
|
|
||||||
// Remove time from pre-programmed values count.
|
|
||||||
numberOfPreProgrammedValues -= 1u;
|
|
||||||
if (ok) {
|
|
||||||
preProgrammedTime = new int32[maxElements];
|
|
||||||
memset(preProgrammedTime, 0, maxElements * sizeof(int32));
|
|
||||||
preProgrammedValues = new float32*[numberOfPreProgrammedValues];
|
|
||||||
uint32 j;
|
|
||||||
for (j = 0u; j < numberOfPreProgrammedValues; j++) {
|
|
||||||
preProgrammedValues[j] = new float32[maxElements];
|
|
||||||
memset(preProgrammedValues[j], 0, maxElements * sizeof(float32));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Number of columns in csv file (%d) is not consistent with the number of output signals (%d)", numberOfPreProgrammedValues,
|
|
||||||
numberOfOutputSignals - 1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
StreamString token;
|
|
||||||
char8 ignored;
|
|
||||||
tokenLine.Seek(0);
|
|
||||||
uint32 idx = 0u;
|
|
||||||
while (tokenLine.GetToken(token, ",", ignored)) {
|
|
||||||
if (idx == 0u) {
|
|
||||||
preProgrammedTime[t] = atoi(token.Buffer());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ok = ((idx - 1) < numberOfPreProgrammedValues);
|
|
||||||
if (ok) {
|
|
||||||
preProgrammedValues[idx - 1][t] = static_cast<float32>(atof(token.Buffer()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(ErrorManagement::FatalError, "Number of columns in csv file is not consistent with the number of output signals in line %d", t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
token = "";
|
|
||||||
idx++;
|
|
||||||
}
|
|
||||||
t++;
|
|
||||||
}
|
|
||||||
tokenLine = "";
|
|
||||||
}
|
|
||||||
f.Close();
|
|
||||||
} else {
|
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Cannot open the file %s", filename.Buffer());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (numberOfPreProgrammedTimeRows > maxElements) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Warning, "Only %d (out of %d) of pre-programmed values will be written to waveform record.",
|
|
||||||
maxElements, numberOfPreProgrammedTimeRows);
|
|
||||||
}
|
|
||||||
ok = MemoryOperationsHelper::Copy(timeSignal, preProgrammedTime, maxElements * sizeof(int32));
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; (i < numberOfPreProgrammedValues) && (ok); ++i) {
|
|
||||||
ok = MemoryOperationsHelper::Copy(valueSignals[i], preProgrammedValues[i], maxElements * sizeof(float32));
|
|
||||||
}
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(ErrorManagement::Warning, "Failed to write data to waveform record.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preProgrammedValues != NULL_PTR(float32 **)) {
|
|
||||||
uint32 i;
|
|
||||||
for (i = 0u; i < numberOfPreProgrammedValues; i++) {
|
|
||||||
delete preProgrammedValues[i];
|
|
||||||
}
|
|
||||||
delete[] preProgrammedValues;
|
|
||||||
}
|
|
||||||
if (preProgrammedTime != NULL_PTR(int32 *)) {
|
|
||||||
delete[] preProgrammedTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JAWFRecordGAM::Execute() {
|
|
||||||
if (*loadTriggerSignal == 1u) {
|
|
||||||
if (readOnce) {
|
|
||||||
LoadFile();
|
|
||||||
readOnce = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Reset read once flag when loadTriggerSignal is reset.
|
|
||||||
readOnce = true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JAWFRecordGAM, "1.0")
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JAWFRecordGAM.h
|
|
||||||
* @brief Header file for class JAWFRecordGAM
|
|
||||||
* @date Jan, 2019
|
|
||||||
* @author rhari
|
|
||||||
*
|
|
||||||
* @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 JAWFRecordGAM
|
|
||||||
* 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_JAWFRECORDGAM_H_
|
|
||||||
#define GAMS_JAWFRECORDGAM_H_
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Standard header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Project header includes */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "GAM.h"
|
|
||||||
#include "Message.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Class declaration */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GAM that is used for pre-programmed operation.
|
|
||||||
*
|
|
||||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
|
||||||
* <pre>
|
|
||||||
* +WFRecordGAM = {
|
|
||||||
* Class = JAWFRecordGAM
|
|
||||||
* Directory = "../Configurations"
|
|
||||||
* InputSignals = {
|
|
||||||
* CSV_LOAD = {
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* Type = uint32
|
|
||||||
* }
|
|
||||||
* Filename = {
|
|
||||||
* Alias = CSV_NAME
|
|
||||||
* DataSource = EPICSCAInput
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* OutputSignals = {
|
|
||||||
* PREP_TIME_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* * MHVPS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* BPS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* APS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* MCPS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* GCPS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* FHPS_PREP_WF = {
|
|
||||||
* DataSource = DDB1
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class JAWFRecordGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
||||||
public:
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
JAWFRecordGAM();
|
|
||||||
|
|
||||||
virtual ~JAWFRecordGAM();
|
|
||||||
|
|
||||||
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:
|
|
||||||
void LoadFile();
|
|
||||||
|
|
||||||
MARTe::uint32 filenameSignalIndex;
|
|
||||||
|
|
||||||
MARTe::uint32 *loadTriggerSignal;
|
|
||||||
|
|
||||||
MARTe::StreamString directory;
|
|
||||||
|
|
||||||
MARTe::float32 **valueSignals;
|
|
||||||
|
|
||||||
MARTe::int32 *timeSignal;
|
|
||||||
|
|
||||||
MARTe::uint32 maxElements;
|
|
||||||
|
|
||||||
// Flag determining whether file should be read (so it isn't read multiple time)
|
|
||||||
bool readOnce;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Inline method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* GAMS_JAWFRECORDGAM_H_ */
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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=JAWFRecordGAM.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)/JAWFRecordGAM$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/JAWFRecordGAM$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# 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 $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
|
||||||
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
|
||||||
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
|
||||||
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
ROOT_DIR=..
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) check-env
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
check-env:
|
|
||||||
ifndef MARTe2_DIR
|
|
||||||
$(error MARTe2_DIR is undefined)
|
|
||||||
endif
|
|
||||||
Reference in New Issue
Block a user