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");
214 bool value)
override;
230 void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
238 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
247 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
256 void Svc_FpySequencer_SequencerStateMachine_action_validate(
264 void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
272 void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
280 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
288 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
296 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
304 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
313 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
321 void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
329 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
337 void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
345 void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
353 void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
361 void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
369 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
377 void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
385 void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
394 void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
402 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
410 void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
418 void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
565 static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
593 U64 m_sequencesStarted;
596 U64 m_statementsDispatched;
605 U32 nextStatementIndex = 0;
628 struct BreakpointInfo {
630 bool breakpointInUse =
false;
632 bool breakOnlyOnceOnBreakpoint =
false;
634 U32 breakpointIndex = 0;
638 bool breakBeforeNextLine =
false;
645 bool reachedEndOfFile =
false;
647 bool nextStatementReadSuccess =
false;
649 U8 nextStatementOpcode = 0;
660 U64 statementsFailed = 0;
662 U64 sequencesSucceeded = 0;
664 U64 sequencesFailed = 0;
666 U64 sequencesCancelled = 0;
671 U64 directiveErrorIndex = 0;
680 static void updateCrc(U32& crc,
704 const FpySequencer_FileReadStage& readStage,
705 bool updateCrc =
true);
712 void handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err);
715 Signal dispatchStatement();
720 Fw::Success deserializeDirective(
const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
723 void dispatchDirective(
const DirectiveUnion& directive,
const Fpy::DirectiveId&
id);
726 Signal checkStatementTimeout();
732 bool isRunningState(
State state);
735 void updateDebugTelemetryStruct();
742 void sendSignal(
Signal signal);
748 U32 currentStatementIdx();
752 Signal waitRel_directiveHandler(
const FpySequencer_WaitRelDirective& directive,
DirectiveError& error);
753 Signal waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error);
754 Signal goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error);
756 Signal noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error);
757 Signal pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
DirectiveError& error);
758 Signal pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
760 Signal pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error);
761 Signal constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error);
762 Signal stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error);
814 Signal exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error);
815 Signal allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error);
816 Signal storeConstOffset_directiveHandler(
const FpySequencer_StoreConstOffsetDirective& directive,
818 Signal load_directiveHandler(
const FpySequencer_LoadDirective& directive,
DirectiveError& error);
819 Signal pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error);
820 Signal discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error);
821 Signal memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error);
822 Signal stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error);
823 Signal pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error);
824 Signal setFlag_directiveHandler(
const FpySequencer_SetFlagDirective& directive,
DirectiveError& error);
825 Signal getFlag_directiveHandler(
const FpySequencer_GetFlagDirective& directive,
DirectiveError& error);
826 Signal getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error);
827 Signal peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error);
828 Signal store_directiveHandler(
const FpySequencer_StoreDirective& directive,
DirectiveError& error);
sets the index of the next directive to execute
Fpy::StackSizeType lvarOffset()
FpySequencer_StackOpDirective stackOp
FwIdType FwOpcodeType
The type of a command opcode.
void directive_load_internalInterfaceHandler(const Svc::FpySequencer_LoadDirective &directive) override
Internal interface handler for directive_load.
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.
PlatformSizeType FwSizeType
FpySequencer_GotoDirective gotoDirective
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive) override
Internal interface handler for directive_stackOp.
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.
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.
void directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive) override
Internal interface handler for directive_constCmd.
FpySequencer_ConstCmdDirective constCmd
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_storeConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreConstOffsetDirective &directive) override
Internal interface handler for directive_storeConstOffset.
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.
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
pops some bytes off the stack and puts them in lvar array
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.
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.
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_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
void directive_store_internalInterfaceHandler(const Svc::FpySequencer_StoreDirective &directive) override
Internal interface handler for directive_store.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
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.
stores bytes from the top of the stack into a memory location, determined by the stack ...
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
FpySequencer_PushTlmValDirective pushTlmVal
gets bytes from lvar array and pushes them to stack
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.
bool Svc_FpySequencer_SequencerStateMachine_guard_breakOnce(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
PlatformIndexType FwIndexType
pushes a const byte array onto stack
RateGroupDivider component implementation.
FpySequencer_SetFlagDirective setFlag
FpySequencer_StoreConstOffsetDirective storeConstOffset
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.
FpySequencer_StoreDirective store
Declares F Prime string base class.
void deallocateBuffer(Fw::MemAllocator &allocator)
FpySequencer_LoadDirective load
pushes the current Fw.Time struct to the stack
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)