7 #ifndef FpySequencer_HPP 8 #define FpySequencer_HPP 32 "Sequence arg count must be below U8 max");
34 "Sequence statement count must be below U16 max");
36 "Max stack size must be below Svc::Fpy::StackSizeType max");
38 "Max stack size must be greater than max tlm buffer size");
40 "Max stack size must be greater than max prm buffer size");
101 template <
typename T>
106 template <
typename T>
259 void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
267 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
276 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
285 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
294 void Svc_FpySequencer_SequencerStateMachine_action_validate(
302 void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
310 void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
318 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
326 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
334 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
342 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
351 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
359 void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
367 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
375 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
383 void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
391 void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
399 void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
407 void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
415 void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
423 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
431 void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
439 void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
448 void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
456 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
464 void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
472 void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
553 U64 sequenceIndex)
override;
557 U64 sequenceIndex)
override;
561 U64 sequenceIndex)
override;
565 U64 sequenceIndex)
override;
569 U64 sequenceIndex)
override;
573 U64 sequenceIndex)
override;
578 U64 sequenceIndex)
override;
582 U64 sequenceIndex)
override;
586 U64 sequenceIndex)
override;
590 U64 sequenceIndex)
override;
594 U64 sequenceIndex)
override;
598 U64 sequenceIndex)
override;
603 U64 sequenceIndex)
override;
607 U64 sequenceIndex)
override;
611 U64 sequenceIndex)
override;
615 U64 sequenceIndex)
override;
619 U64 sequenceIndex)
override;
623 U64 sequenceIndex)
override;
627 U64 sequenceIndex)
override;
631 U64 sequenceIndex)
override;
635 U64 sequenceIndex)
override;
639 U64 sequenceIndex)
override;
643 U64 sequenceIndex)
override;
647 U64 sequenceIndex)
override;
651 U64 sequenceIndex)
override;
655 U64 sequenceIndex)
override;
659 U64 sequenceIndex)
override;
663 U64 sequenceIndex)
override;
668 U64 sequenceIndex)
override;
672 U64 sequenceIndex)
override;
676 U64 sequenceIndex)
override;
694 static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
735 U64 m_sequencesStarted;
738 U64 m_statementsDispatched;
744 std::atomic<bool> m_checkTimersQueued;
747 std::atomic<bool> m_tlmWriteQueued;
756 U32 nextStatementIndex = 0;
771 bool rngSeeded =
false;
773 Stack stack = Stack();
778 struct BreakpointInfo {
780 bool breakpointInUse =
false;
782 bool breakOnlyOnceOnBreakpoint =
false;
784 U32 breakpointIndex = 0;
788 bool breakBeforeNextLine =
false;
795 bool reachedEndOfFile =
false;
797 bool nextStatementReadSuccess =
false;
799 U8 nextStatementOpcode = 0;
803 U32 nextStatementIndex = 0;
812 U64 statementsFailed = 0;
814 U64 sequencesSucceeded = 0;
816 U64 sequencesFailed = 0;
818 U64 sequencesCancelled = 0;
823 U64 directiveErrorIndex = 0;
831 bool m_sandboxConfigured;
856 const FpySequencer_FileReadStage& readStage,
857 bool updateCrc =
true);
864 void handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err);
867 Signal dispatchStatement();
872 Fw::Success deserializeDirective(
const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
875 void dispatchDirective(
const DirectiveUnion& directive,
const Fpy::DirectiveId&
id);
878 Signal checkStatementTimeout();
884 bool isRunningState(
State state);
888 bool checkDirectiveExpected(Fpy::DirectiveId directive, U64 sequenceIndex);
891 void updateDebugTelemetryStruct();
898 void sendSignal(
Signal signal);
904 U32 currentStatementIdx();
908 Signal waitRel_directiveHandler(
const FpySequencer_WaitRelDirective& directive,
DirectiveError& error);
909 Signal waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error);
910 Signal goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error);
912 Signal noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error);
913 Signal pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
DirectiveError& error);
914 Signal pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
916 Signal pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error);
917 Signal constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error);
918 Signal stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error);
972 Signal exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error);
973 Signal allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error);
978 Signal storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
980 Signal loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error);
981 Signal pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error);
982 Signal discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error);
983 Signal memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error);
984 Signal stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error);
985 Signal pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error);
986 Signal setSeed_directiveHandler(
const FpySequencer_SetSeedDirective& directive,
DirectiveError& error);
987 Signal pushRand_directiveHandler(
const FpySequencer_PushRandDirective& directive,
DirectiveError& error);
988 Signal getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error);
989 Signal peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error);
990 Signal storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error);
991 Signal call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error);
992 Signal return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error);
993 Signal loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error);
994 Signal storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error);
995 Signal storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
997 Signal popEvent_directiveHandler(
const FpySequencer_PopEventDirective& directive,
DirectiveError& error);
998 Signal popSerializable_directiveHandler(
const FpySequencer_PopSerializableDirective& directive,
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_allocate.
sets the index of the next directive to execute
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_stackOp.
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_waitAbs.
FpySequencer_StackOpDirective stackOp
void tlmWriteInternal_overflowHook() override
Overflow hook for tlmWriteInternal.
FwIdType FwOpcodeType
The type of a command opcode.
pushes the next RNG value to the stack
void directive_call_internalInterfaceHandler(const Svc::FpySequencer_CallDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_call.
branches based off of the top byte of the stack
FpySequencer_CallDirective call
PlatformSizeType FwSizeType
FpySequencer_GotoDirective gotoDirective
stores a value to an absolute address in the stack (for global variables), offset from stack ...
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeRelConstOffset.
FpySequencer_StoreRelDirective storeRel
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
void directive_loadAbs_internalInterfaceHandler(const Svc::FpySequencer_LoadAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_loadAbs.
returns from a function call
void directive_storeAbsConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsConstOffsetDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeAbsConstOffset.
U8 bytes[Fpy::MAX_STACK_SIZE]
void pingIn_handler(FwIndexType portNum, U32 key) override
Handler for input port pingIn.
void directive_pushVal_internalInterfaceHandler(const Svc::FpySequencer_PushValDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushVal.
void directive_noOp_internalInterfaceHandler(const Svc::FpySequencer_NoOpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_noOp.
FwIdType FwPrmIdType
The type of a parameter identifier.
FpySequencer_PopSerializableDirective popSerializable
stores a value to a local variable at a compile-time-known offset relative to the current stack frame...
FpySequencer_ConstCmdDirective constCmd
void directive_loadRel_internalInterfaceHandler(const Svc::FpySequencer_LoadRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_loadRel.
Fpy::StackSizeType currentFrameStart
pop an opcode and arg buf off the stack, send to cmd dispatcher and await response ...
FpySequencer_WaitRelDirective waitRel
SmId
State machine identifiers.
FpySequencer_WaitAbsDirective waitAbs
FpySequencer_LoadAbsDirective loadAbs
Enum representing a command response.
FpySequencer_PeekDirective peek
FpySequencer_PushValDirective pushVal
FpySequencer_PopEventDirective popEvent
void directive_pushPrm_internalInterfaceHandler(const Svc::FpySequencer_PushPrmDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushPrm.
pops bytes off the top of the stack and does nothing with them
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_goto.
FpySequencer_IfDirective ifDirective
FpySequencer_NoOpDirective noOp
FpySequencer_PushTimeDirective pushTime
FpySequencer_GetFieldDirective getField
FpySequencer_PushTlmValAndTimeDirective pushTlmValAndTime
Fpy::DirectiveErrorCode DirectiveError
FpySequencer_LoadRelDirective loadRel
executes a cmd with const args
loads a value from a local variable at a compile-time-known offset relative to the current stack fram...
void parametersLoaded() override
Called whenever parameters are loaded.
FpySequencer_ReturnDirective returnDirective
FpySequencer_AllocateDirective allocate
pop two byte arrays off the top of the stack, call memcmp, push 1 if they were equal, 0 otherwise
void tlmWrite_handler(FwIndexType portNum, U32 context) override
Handler for input port tlmWrite.
void directive_setSeed_internalInterfaceHandler(const Svc::FpySequencer_SetSeedDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_setSeed.
pops a severity and message from the stack and emits an F Prime event
void pushZeroes(Fpy::StackSizeType byteCount)
void checkTimersInternal_internalInterfaceHandler() override
Internal interface handler for checkTimersInternal.
FpySequencer_StoreAbsDirective storeAbs
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeRel.
static constexpr FwSizeType MAX_PATH_LENGTH
Maximum supported path length for resolution buffers.
stores a value to an absolute address in the stack (for global variables), const offset ...
FpySequencer_DiscardDirective discard
FpySequencer_PushPrmDirective pushPrm
External serialize buffer with no copy semantics.
FpySequencer_SequencerStateMachineStateMachineBase::State State
Sequencer blocking state.
void directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeAbs.
void directive_stackCmd_internalInterfaceHandler(const Svc::FpySequencer_StackCmdDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_stackCmd.
FpySequencer_PushRandDirective pushRand
void directive_pushRand_internalInterfaceHandler(const Svc::FpySequencer_PushRandDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushRand.
void parameterUpdated(FwPrmIdType id) override
Called whenever a parameter is updated.
peeks at N bytes from the stack, starting from an offset relative to the top of the stack ...
bool Svc_FpySequencer_SequencerStateMachine_guard_shouldBreak(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
void directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_constCmd.
A generic interface for creating and comparing hash values.
void directive_return_internalInterfaceHandler(const Svc::FpySequencer_ReturnDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_return.
void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator &allocator, FwSizeType bytes)
FpySequencer_MemCmpDirective memCmp
FpySequencer_StackCmdDirective stackCmd
void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize)
void tlmWriteInternal_internalInterfaceHandler() override
Internal interface handler for tlmWriteInternal.
void directive_getField_internalInterfaceHandler(const Svc::FpySequencer_GetFieldDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_getField.
sleeps for a relative duration from the current time
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTlmValAndTime.
uint8_t U8
8-bit unsigned integer
FpySequencer_PushTlmValDirective pushTlmVal
void directive_pushTlmVal_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTlmVal.
friend class FpySequencerTester
generic stack operation handler
void seqCancelIn_handler(FwIndexType portNum) override
Memory Allocation base class.
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_if.
sleeps until an absolute time
void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) override
Handler for input port cmdResponseIn.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_exit.
void directive_popSerializable_internalInterfaceHandler(const Svc::FpySequencer_PopSerializableDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_popSerializable.
void checkTimers_handler(FwIndexType portNum, U32 context) override
Handler for input port checkTimers.
FpySequencer_StoreAbsConstOffsetDirective storeAbsConstOffset
loads a value from an absolute address in the stack (for global variables)
bool Svc_FpySequencer_SequencerStateMachine_guard_breakOnce(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
PlatformIndexType FwIndexType
void configureSandbox(const char *directory)
pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
void directive_waitRel_internalInterfaceHandler(const FpySequencer_WaitRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_waitRel.
pops serialized data from stack and sends to serial output port
void directive_peek_internalInterfaceHandler(const Svc::FpySequencer_PeekDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_peek.
Svc::FpySequencer_SequencerStateMachine_State State
The state type.
pushes a const byte array onto stack
stores a value to a local variable at a runtime-determined offset relative to the current stack frame...
RateGroupDivider component implementation.
FpySequencer_SetSeedDirective setSeed
Defines a base class for a memory allocator for classes.
pushes a prm buf to the stack
void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args) override
Handler for input port seqRunIn.
void move(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType moveSize)
Declares F Prime string base class.
void deallocateBuffer(Fw::MemAllocator &allocator)
pushes the current Fw.Time struct to the stack
FpySequencer_StoreRelConstOffsetDirective storeRelConstOffset
Auto-generated base for FpySequencer component.
pushes some empty bytes to the stack
void directive_pushTime_internalInterfaceHandler(const Svc::FpySequencer_PushTimeDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTime.
FpySequencer_ExitDirective exit
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
void directive_popEvent_internalInterfaceHandler(const Svc::FpySequencer_PopEventDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_popEvent.
void directive_memCmp_internalInterfaceHandler(const Svc::FpySequencer_MemCmpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_memCmp.
pushes a tlm buf to the stack
void directive_discard_internalInterfaceHandler(const Svc::FpySequencer_DiscardDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_discard.
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
FpySequencer(const char *const compName)