fixed types

This commit is contained in:
Martino Ferrari
2026-02-06 17:48:05 +01:00
parent e1549afa07
commit 12ceba0bf6
2 changed files with 104 additions and 109 deletions

View File

@@ -32,6 +32,7 @@
#include "JASDNRTStateMachineGAM.h" #include "JASDNRTStateMachineGAM.h"
#include "AdvancedErrorManagement.h" #include "AdvancedErrorManagement.h"
#include "TypeDescriptor.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Static definitions */ /* Static definitions */
@@ -54,7 +55,7 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
mhvps_hvon = 0; mhvps_hvon = 0;
// Parameters which get from Input signals. // Parameters which get from Input signals.
triggerSignal = NULL_PTR(MARTe::uint32 *); triggerSignal = NULL_PTR(MARTe::uint8 *);
currentTime = NULL_PTR(MARTe::uint32 *); currentTime = NULL_PTR(MARTe::uint32 *);
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *); triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *); triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
@@ -62,16 +63,16 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *); triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *); triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *); triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
stopRequest = NULL_PTR(MARTe::uint32 *); stopRequest = NULL_PTR(MARTe::uint8 *);
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *); modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
sdnCommand = NULL_PTR(MARTe::uint16 *); sdnCommand = NULL_PTR(MARTe::uint16 *);
// write out target. // write out target.
outputSignal = NULL_PTR(MARTe::uint32 *); outputSignal = NULL_PTR(MARTe::uint32 *);
outputBeamON = NULL_PTR(MARTe::uint32 *); outputBeamON = NULL_PTR(MARTe::uint8 *);
outputHVArmed = NULL_PTR(MARTe::uint32 *); outputHVArmed = NULL_PTR(MARTe::uint8 *);
outputHVInjection = NULL_PTR(MARTe::uint32 *); outputHVInjection = NULL_PTR(MARTe::uint8 *);
outputRFON = NULL_PTR(MARTe::uint32 *); outputRFON = NULL_PTR(MARTe::uint8 *);
outputBeamONTime = NULL_PTR(MARTe::uint32 *); outputBeamONTime = NULL_PTR(MARTe::uint32 *);
outputRFONTime = NULL_PTR(MARTe::uint32 *); outputRFONTime = NULL_PTR(MARTe::uint32 *);
shotCounter = NULL_PTR(MARTe::uint32 *); shotCounter = NULL_PTR(MARTe::uint32 *);
@@ -149,7 +150,7 @@ bool JASDNRTStateMachineGAM::Setup() {
uint32 c; uint32 c;
for (c = 0u; c < numberOfInputSignals; c++) { for (c = 0u; c < numberOfInputSignals; c++) {
TypeDescriptor inputType = GetSignalType(InputSignals, c); TypeDescriptor inputType = GetSignalType(InputSignals, c);
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit); ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit || inputType == UnsignedInteger8Bit);
if (!ok) { if (!ok) {
StreamString signalName; StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName); (void) GetSignalName(InputSignals, c, signalName);
@@ -162,7 +163,7 @@ bool JASDNRTStateMachineGAM::Setup() {
uint32 c; uint32 c;
for (c = 0u; c < numberOfOutputSignals; c++) { for (c = 0u; c < numberOfOutputSignals; c++) {
TypeDescriptor outputType = GetSignalType(OutputSignals, c); TypeDescriptor outputType = GetSignalType(OutputSignals, c);
ok = (outputType == UnsignedInteger32Bit); ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
if (!ok) { if (!ok) {
StreamString signalName; StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName); (void) GetSignalName(InputSignals, c, signalName);
@@ -172,22 +173,22 @@ bool JASDNRTStateMachineGAM::Setup() {
} }
if (ok) { if (ok) {
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0)); currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1)); triggerSignal = reinterpret_cast<uint8 *>(GetInputSignalMemory(1));
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2)); triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3)); triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4)); triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5)); triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6)); triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7)); triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8)); stopRequest = reinterpret_cast<uint8 *>(GetInputSignalMemory(8));
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9)); modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10)); sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0)); outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1)); outputBeamON = reinterpret_cast<uint8 *>(GetOutputSignalMemory(1));
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2)); outputHVArmed = reinterpret_cast<uint8 *>(GetOutputSignalMemory(2));
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3)); outputHVInjection = reinterpret_cast<uint8 *>(GetOutputSignalMemory(3));
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4)); outputRFON = reinterpret_cast<uint8 *>(GetOutputSignalMemory(4));
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5)); outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6)); outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7)); shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));

View File

@@ -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 JARTStateMachineGAM * @details This header file contains the declaration of the class
JARTStateMachineGAM
* 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.
*/ */
@@ -41,13 +42,9 @@
/** /**
* @brief GAM provides real-time state machine that communicate with SDN packet. * @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): * The configuration syntax is (names and signal quantity are only given as an
* <pre> * example): <pre> +GAMSDNRealTimeStateMachine = { Class =
* +GAMSDNRealTimeStateMachine = { * JASDNRTStateMachineGAM ConditionTrigger = 1 mhvps_hvon = 4 aps_hvon = 1
* Class = JASDNRTStateMachineGAM
* ConditionTrigger = 1
* mhvps_hvon = 4
* aps_hvon = 1
* aps_swon = 16 * aps_swon = 16
* bps_hvon = 2 * bps_hvon = 2
* bps_swon = 8 * bps_swon = 8
@@ -140,109 +137,106 @@
class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI { class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
public: public:
CLASS_REGISTER_DECLARATION() CLASS_REGISTER_DECLARATION()
JASDNRTStateMachineGAM(); JASDNRTStateMachineGAM();
virtual ~JASDNRTStateMachineGAM(); virtual ~JASDNRTStateMachineGAM();
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);
private: private:
//The list of possible states // The list of possible states
enum JARealTimeState { enum JARealTimeState {
WaitTrigger = 0, WaitTrigger = 0,
SwitchingHVPS_HVON = 1, SwitchingHVPS_HVON = 1,
WaitSDNTrigger = 2, WaitSDNTrigger = 2,
SwitchingHVPS_SWON = 3, SwitchingHVPS_SWON = 3,
RFON = 4, RFON = 4,
HVTerminate = 5 HVTerminate = 5
}; };
//The current rtState // The current rtState
JARealTimeState currentState; JARealTimeState currentState;
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Static parameter given by cfg File // Static parameter given by cfg File
///////////////////////////////////////////////// /////////////////////////////////////////////////
//A given condition // A given condition
MARTe::uint32 conditionTrigger; MARTe::uint32 conditionTrigger;
//What to output in a given state and condition // What to output in a given state and condition
MARTe::uint32 mhvps_hvon; MARTe::uint32 mhvps_hvon;
MARTe::uint32 aps_hvon; MARTe::uint32 aps_hvon;
MARTe::uint32 aps_swon; MARTe::uint32 aps_swon;
MARTe::uint32 bps_hvon; MARTe::uint32 bps_hvon;
MARTe::uint32 bps_swon; MARTe::uint32 bps_swon;
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Input signals // Input signals
///////////////////////////////////////////////// /////////////////////////////////////////////////
//The trigger signal (PLC_ON) // The trigger signal (PLC_ON)
MARTe::uint32 *triggerSignal; MARTe::uint8 *triggerSignal;
//Time signal (Time from TimerGAM) // Time signal (Time from TimerGAM)
MARTe::uint32 *currentTime; MARTe::uint32 *currentTime;
// Input signals for trigger delay parameters // Input signals for trigger delay parameters
MARTe::uint32 *triggerDelay_mhvps_hvon; MARTe::uint32 *triggerDelay_mhvps_hvon;
MARTe::uint32 *triggerDelay_aps_hvon; MARTe::uint32 *triggerDelay_aps_hvon;
MARTe::uint32 *triggerDelay_aps_swon; MARTe::uint32 *triggerDelay_aps_swon;
MARTe::uint32 *triggerDelay_bps_hvon; MARTe::uint32 *triggerDelay_bps_hvon;
MARTe::uint32 *triggerDelay_bps_swon; MARTe::uint32 *triggerDelay_bps_swon;
MARTe::uint32 *triggerDelay_shotlen; MARTe::uint32 *triggerDelay_shotlen;
// Input signal for sequence stop request. // Input signal for sequence stop request.
MARTe::uint32 *stopRequest; MARTe::uint8 *stopRequest;
// Input signal for pulse length limit by mode. // Input signal for pulse length limit by mode.
MARTe::uint32 *modePulseLengthLimit; MARTe::uint32 *modePulseLengthLimit;
// Input signal for SDN commands. // Input signal for SDN commands.
MARTe::uint16 *sdnCommand; MARTe::uint16 *sdnCommand;
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Output signal to which the output value will be written. // Output signal to which the output value will be written.
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// One state write One signal. // One state write One signal.
MARTe::uint32 *outputSignal; MARTe::uint32 *outputSignal;
// state notify output // state notify output
MARTe::uint32 *outputBeamON; MARTe::uint8 *outputBeamON;
MARTe::uint32 *outputHVArmed; MARTe::uint8 *outputHVArmed;
MARTe::uint32 *outputHVInjection; MARTe::uint8 *outputHVInjection;
MARTe::uint32 *outputRFON; MARTe::uint8 *outputRFON;
// elapsed time notify output; // elapsed time notify output;
MARTe::uint32 *outputBeamONTime; MARTe::uint32 *outputBeamONTime;
MARTe::uint32 *outputRFONTime; MARTe::uint32 *outputRFONTime;
// shot counter (coutup every RFON time.) // shot counter (coutup every RFON time.)
MARTe::uint32 *shotCounter; MARTe::uint32 *shotCounter;
////////////////////////////// //////////////////////////////
//Internal Parameters // Internal Parameters
////////////////////////////// //////////////////////////////
//PLC_ON time holder // PLC_ON time holder
MARTe::uint32 plcOnTime; MARTe::uint32 plcOnTime;
//APS_SWON time holder // APS_SWON time holder
MARTe::uint32 apsSwonTime; MARTe::uint32 apsSwonTime;
MARTe::uint32 apsSwoffTime; MARTe::uint32 apsSwoffTime;
//PS turn off delay // PS turn off delay
MARTe::uint32 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;
// 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 */ /* Inline method definitions */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/