7 #ifndef FpySequencer_HPP 8 #define FpySequencer_HPP 27 "Sequence arg count must be below U8 max");
29 "Sequence statement count must be below U16 max");
31 "Max stack size must be below Svc::Fpy::StackSizeType max");
33 "Max stack size must be greater than max tlm buffer size");
35 "Max stack size must be greater than max prm buffer size");
36 static_assert(
Svc::Fpy::FLAG_COUNT < std::numeric_limits<U8>::max(),
"Flag count must be less than U8 max");
100 template <
typename T>
228 bool value)
override;
244 void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
252 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
261 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
270 void Svc_FpySequencer_SequencerStateMachine_action_validate(
278 void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
286 void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
294 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
302 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
310 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
318 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
327 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
335 void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
343 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
351 void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
359 void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
367 void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
375 void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
383 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
391 void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
399 void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
408 void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
416 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
424 void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
432 void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
595 static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
623 U64 m_sequencesStarted;
626 U64 m_statementsDispatched;
635 U32 nextStatementIndex = 0;
658 struct BreakpointInfo {
660 bool breakpointInUse =
false;
662 bool breakOnlyOnceOnBreakpoint =
false;
664 U32 breakpointIndex = 0;
668 bool breakBeforeNextLine =
false;
675 bool reachedEndOfFile =
false;
677 bool nextStatementReadSuccess =
false;
679 U8 nextStatementOpcode = 0;
690 U64 statementsFailed = 0;
692 U64 sequencesSucceeded = 0;
694 U64 sequencesFailed = 0;
696 U64 sequencesCancelled = 0;
701 U64 directiveErrorIndex = 0;
710 static void updateCrc(U32& crc,
734 const FpySequencer_FileReadStage& readStage,
735 bool updateCrc =
true);
742 void handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err);
745 Signal dispatchStatement();
750 Fw::Success deserializeDirective(
const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
753 void dispatchDirective(
const DirectiveUnion& directive,
const Fpy::DirectiveId&
id);
756 Signal checkStatementTimeout();
762 bool isRunningState(
State state);
765 void updateDebugTelemetryStruct();
772 void sendSignal(
Signal signal);
778 U32 currentStatementIdx();
782 Signal waitRel_directiveHandler(
const FpySequencer_WaitRelDirective& directive,
DirectiveError& error);
783 Signal waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error);
784 Signal goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error);
786 Signal noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error);
787 Signal pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
DirectiveError& error);
788 Signal pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
790 Signal pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error);
791 Signal constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error);
792 Signal stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error);
844 Signal exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error);
845 Signal allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error);
850 Signal storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
852 Signal loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error);
853 Signal pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error);
854 Signal discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error);
855 Signal memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error);
856 Signal stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error);
857 Signal pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error);
858 Signal setFlag_directiveHandler(
const FpySequencer_SetFlagDirective& directive,
DirectiveError& error);
859 Signal getFlag_directiveHandler(
const FpySequencer_GetFlagDirective& directive,
DirectiveError& error);
860 Signal getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error);
861 Signal peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error);
862 Signal storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error);
863 Signal call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error);
864 Signal return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error);
865 Signal loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error);
866 Signal storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error);
867 Signal storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive) override
Internal interface handler for directive_storeRelConstOffset.
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive) override
Internal interface handler for directive_storeRel.
void directive_return_internalInterfaceHandler(const Svc::FpySequencer_ReturnDirective &directive) override
Internal interface handler for directive_return.
sets the index of the next directive to execute
void directive_call_internalInterfaceHandler(const Svc::FpySequencer_CallDirective &directive) override
Internal interface handler for directive_call.
FpySequencer_StackOpDirective stackOp
FwIdType FwOpcodeType
The type of a command opcode.
branches based off of the top byte of the stack
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive) override
Internal interface handler for directive_if.
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_loadAbs_internalInterfaceHandler(const Svc::FpySequencer_LoadAbsDirective &directive) override
Internal interface handler for directive_loadAbs.
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive) override
Internal interface handler for directive_stackOp.
FpySequencer_StoreRelDirective storeRel
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
void directive_getField_internalInterfaceHandler(const Svc::FpySequencer_GetFieldDirective &directive) override
Internal interface handler for directive_getField.
returns from a function call
U8 bytes[Fpy::MAX_STACK_SIZE]
void pingIn_handler(FwIndexType portNum, U32 key) override
Handler for input port pingIn.
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive) override
Internal interface handler for directive_pushTlmValAndTime.
FwIdType FwPrmIdType
The type of a parameter identifier.
stores a value to a local variable at a compile-time-known offset relative to the current stack frame...
void directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive) override
Internal interface handler for directive_constCmd.
FpySequencer_ConstCmdDirective constCmd
Fpy::StackSizeType currentFrameStart
pop an opcode and arg buf off the stack, send to cmd dispatcher and await response ...
void directive_peek_internalInterfaceHandler(const Svc::FpySequencer_PeekDirective &directive) override
Internal interface handler for directive_peek.
FpySequencer_WaitRelDirective waitRel
SmId
State machine identifiers.
FpySequencer_WaitAbsDirective waitAbs
void directive_loadRel_internalInterfaceHandler(const Svc::FpySequencer_LoadRelDirective &directive) override
Internal interface handler for directive_loadRel.
void directive_memCmp_internalInterfaceHandler(const Svc::FpySequencer_MemCmpDirective &directive) override
Internal interface handler for directive_memCmp.
void directive_pushVal_internalInterfaceHandler(const Svc::FpySequencer_PushValDirective &directive) override
Internal interface handler for directive_pushVal.
FpySequencer_LoadAbsDirective loadAbs
Enum representing a command response.
FpySequencer_PeekDirective peek
void directive_pushPrm_internalInterfaceHandler(const Svc::FpySequencer_PushPrmDirective &directive) override
Internal interface handler for directive_pushPrm.
FpySequencer_PushValDirective pushVal
pops bytes off the top of the stack and does nothing with them
void directive_pushTime_internalInterfaceHandler(const Svc::FpySequencer_PushTimeDirective &directive) override
Internal interface handler for directive_pushTime.
FpySequencer_IfDirective ifDirective
FpySequencer_NoOpDirective noOp
FpySequencer_PushTimeDirective pushTime
void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename) override
Handler for input port seqRunIn.
FpySequencer_GetFieldDirective getField
FpySequencer_PushTlmValAndTimeDirective pushTlmValAndTime
Fpy::DirectiveErrorCode DirectiveError
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive) override
Internal interface handler for directive_allocate.
FpySequencer_LoadRelDirective loadRel
executes a cmd with const args
void directive_waitRel_internalInterfaceHandler(const FpySequencer_WaitRelDirective &directive) override
Internal interface handler for directive_waitRel.
void directive_noOp_internalInterfaceHandler(const Svc::FpySequencer_NoOpDirective &directive) override
Internal interface handler for directive_noOp.
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.
void directive_stackCmd_internalInterfaceHandler(const Svc::FpySequencer_StackCmdDirective &directive) override
Internal interface handler for directive_stackCmd.
void directive_discard_internalInterfaceHandler(const Svc::FpySequencer_DiscardDirective &directive) override
Internal interface handler for directive_discard.
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 pushZeroes(Fpy::StackSizeType byteCount)
FpySequencer_GetFlagDirective getFlag
FpySequencer_StoreAbsDirective storeAbs
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
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
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive) override
Internal interface handler for directive_waitAbs.
void parameterUpdated(FwPrmIdType id) override
Called whenever a parameter is updated.
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive) override
Internal interface handler for directive_goto.
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 allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator &allocator, FwSizeType bytes)
FpySequencer_MemCmpDirective memCmp
FpySequencer_StackCmdDirective stackCmd
void directive_getFlag_internalInterfaceHandler(const Svc::FpySequencer_GetFlagDirective &directive) override
Internal interface handler for directive_getFlag.
void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize)
void directive_storeAbsConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsConstOffsetDirective &directive) override
Internal interface handler for directive_storeAbsConstOffset.
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
FpySequencer_PushTlmValDirective pushTlmVal
friend class FpySequencerTester
generic stack operation handler
Memory Allocation base class.
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 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
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_SetFlagDirective setFlag
void directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive) override
Internal interface handler for directive_storeAbs.
Defines a base class for a memory allocator for classes.
pushes a prm buf to the stack
void directive_setFlag_internalInterfaceHandler(const Svc::FpySequencer_SetFlagDirective &directive) override
Internal interface handler for directive_setFlag.
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
pops a bool off the stack, sets a flag with a specific index to that bool
FpySequencer_ExitDirective exit
gets a flag and pushes its value as a U8 to the stack
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
pushes a tlm buf to the stack
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
void directive_pushTlmVal_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValDirective &directive) override
Internal interface handler for directive_pushTlmVal.
FpySequencer(const char *const compName)