From 12ceba0bf6c9abc2cd4b542af15b9de8327dfbda Mon Sep 17 00:00:00 2001 From: Martino Ferrari Date: Fri, 6 Feb 2026 17:48:05 +0100 Subject: [PATCH] fixed types --- .../JASDNRTStateMachineGAM.cpp | 29 +-- .../JASDNRTStateMachineGAM.h | 184 +++++++++--------- 2 files changed, 104 insertions(+), 109 deletions(-) diff --git a/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.cpp b/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.cpp index d164e89..92b2fca 100644 --- a/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.cpp +++ b/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.cpp @@ -32,6 +32,7 @@ #include "JASDNRTStateMachineGAM.h" #include "AdvancedErrorManagement.h" +#include "TypeDescriptor.h" /*---------------------------------------------------------------------------*/ /* Static definitions */ @@ -54,7 +55,7 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() { mhvps_hvon = 0; // Parameters which get from Input signals. - triggerSignal = NULL_PTR(MARTe::uint32 *); + triggerSignal = NULL_PTR(MARTe::uint8 *); currentTime = NULL_PTR(MARTe::uint32 *); triggerDelay_mhvps_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_swon = 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 *); 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 *); + outputBeamON = NULL_PTR(MARTe::uint8 *); + outputHVArmed = NULL_PTR(MARTe::uint8 *); + outputHVInjection = NULL_PTR(MARTe::uint8 *); + outputRFON = NULL_PTR(MARTe::uint8 *); outputBeamONTime = NULL_PTR(MARTe::uint32 *); outputRFONTime = NULL_PTR(MARTe::uint32 *); shotCounter = NULL_PTR(MARTe::uint32 *); @@ -149,7 +150,7 @@ bool JASDNRTStateMachineGAM::Setup() { uint32 c; for (c = 0u; c < numberOfInputSignals; c++) { TypeDescriptor inputType = GetSignalType(InputSignals, c); - ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit); + ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit || inputType == UnsignedInteger8Bit); if (!ok) { StreamString signalName; (void) GetSignalName(InputSignals, c, signalName); @@ -162,7 +163,7 @@ bool JASDNRTStateMachineGAM::Setup() { uint32 c; for (c = 0u; c < numberOfOutputSignals; c++) { TypeDescriptor outputType = GetSignalType(OutputSignals, c); - ok = (outputType == UnsignedInteger32Bit); + ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit); if (!ok) { StreamString signalName; (void) GetSignalName(InputSignals, c, signalName); @@ -172,22 +173,22 @@ bool JASDNRTStateMachineGAM::Setup() { } if (ok) { currentTime = reinterpret_cast(GetInputSignalMemory(0)); - triggerSignal = reinterpret_cast(GetInputSignalMemory(1)); + triggerSignal = reinterpret_cast(GetInputSignalMemory(1)); triggerDelay_mhvps_hvon = reinterpret_cast(GetInputSignalMemory(2)); triggerDelay_aps_hvon = reinterpret_cast(GetInputSignalMemory(3)); triggerDelay_aps_swon = reinterpret_cast(GetInputSignalMemory(4)); triggerDelay_bps_hvon = reinterpret_cast(GetInputSignalMemory(5)); triggerDelay_bps_swon = reinterpret_cast(GetInputSignalMemory(6)); triggerDelay_shotlen = reinterpret_cast(GetInputSignalMemory(7)); - stopRequest = reinterpret_cast(GetInputSignalMemory(8)); + stopRequest = reinterpret_cast(GetInputSignalMemory(8)); modePulseLengthLimit = reinterpret_cast(GetInputSignalMemory(9)); sdnCommand = reinterpret_cast(GetInputSignalMemory(10)); outputSignal = reinterpret_cast(GetOutputSignalMemory(0)); - outputBeamON = reinterpret_cast(GetOutputSignalMemory(1)); - outputHVArmed = reinterpret_cast(GetOutputSignalMemory(2)); - outputHVInjection = reinterpret_cast(GetOutputSignalMemory(3)); - outputRFON = reinterpret_cast(GetOutputSignalMemory(4)); + outputBeamON = reinterpret_cast(GetOutputSignalMemory(1)); + outputHVArmed = reinterpret_cast(GetOutputSignalMemory(2)); + outputHVInjection = reinterpret_cast(GetOutputSignalMemory(3)); + outputRFON = reinterpret_cast(GetOutputSignalMemory(4)); outputBeamONTime = reinterpret_cast(GetOutputSignalMemory(5)); outputRFONTime = reinterpret_cast(GetOutputSignalMemory(6)); shotCounter = reinterpret_cast(GetOutputSignalMemory(7)); diff --git a/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.h b/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.h index 91b4199..4a31653 100644 --- a/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.h +++ b/EC-GN-JA-PCF-IN/src/main/c++/GAMs/JASDNRTStateMachineGAM/JASDNRTStateMachineGAM.h @@ -16,7 +16,8 @@ * 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 + * @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. */ @@ -41,13 +42,9 @@ /** * @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): - *
- *         +GAMSDNRealTimeStateMachine = {
- *           Class = JASDNRTStateMachineGAM
- *           ConditionTrigger = 1
- *           mhvps_hvon = 4
- *           aps_hvon = 1
+ * The configuration syntax is (names and signal quantity are only given as an
+ * example): 
 +GAMSDNRealTimeStateMachine = { Class =
+ * JASDNRTStateMachineGAM ConditionTrigger = 1 mhvps_hvon = 4 aps_hvon = 1
  *           aps_swon = 16
  *           bps_hvon = 2
  *           bps_swon = 8
@@ -135,114 +132,111 @@
  *           }
  *       }
  * 
- * + * */ class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI { 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, - const MARTe::char8 * const nextStateName); + 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 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; + // 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; + ///////////////////////////////////////////////// + // 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; + ///////////////////////////////////////////////// + // Input signals + ///////////////////////////////////////////////// + // The trigger signal (PLC_ON) + MARTe::uint8 *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::uint8 *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; + ///////////////////////////////////////////////////////////// + // Output signal to which the output value will be written. + ///////////////////////////////////////////////////////////// + // One state write One signal. + MARTe::uint32 *outputSignal; + // state notify output + MARTe::uint8 *outputBeamON; + MARTe::uint8 *outputHVArmed; + MARTe::uint8 *outputHVInjection; + MARTe::uint8 *outputRFON; + // elapsed time notify output; + MARTe::uint32 *outputBeamONTime; + MARTe::uint32 *outputRFONTime; + // shot counter (coutup every RFON time.) + MARTe::uint32 *shotCounter; - //PS turn off delay - MARTe::uint32 turn_off_delay; + ////////////////////////////// + // Internal Parameters + ////////////////////////////// + // PLC_ON time holder + MARTe::uint32 plcOnTime; + // APS_SWON time holder + MARTe::uint32 apsSwonTime; + MARTe::uint32 apsSwoffTime; - //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; + // 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 */ /*---------------------------------------------------------------------------*/