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");
174 bool value)
override;
183 void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
191 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
200 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
209 void Svc_FpySequencer_SequencerStateMachine_action_validate(
217 void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
225 void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
233 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
241 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
249 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
257 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
266 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
274 void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
282 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
290 void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
298 void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
306 void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
314 void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
322 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
330 void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
338 void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
347 void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
355 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
363 void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
371 void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
509 static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
537 U64 m_sequencesStarted;
540 U64 m_statementsDispatched;
549 U32 nextStatementIndex = 0;
575 struct BreakpointInfo {
577 bool breakpointInUse =
false;
579 bool breakOnlyOnceOnBreakpoint =
false;
581 U32 breakpointIndex = 0;
585 bool breakBeforeNextLine =
false;
592 bool reachedEndOfFile =
false;
594 bool nextStatementReadSuccess =
false;
596 U8 nextStatementOpcode = 0;
603 U64 statementsFailed = 0;
605 U64 sequencesSucceeded = 0;
607 U64 sequencesFailed = 0;
609 U64 sequencesCancelled = 0;
614 U64 directiveErrorIndex = 0;
623 static void updateCrc(U32& crc,
647 const FpySequencer_FileReadStage& readStage,
648 bool updateCrc =
true);
655 void handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err);
658 Signal dispatchStatement();
663 Fw::Success deserializeDirective(
const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
666 void dispatchDirective(
const DirectiveUnion& directive,
const Fpy::DirectiveId&
id);
669 Signal checkStatementTimeout();
675 bool isRunningState(
State state);
678 void updateDebugTelemetryStruct();
685 void sendSignal(
Signal signal);
692 template <
typename T>
697 template <
typename T>
707 U32 currentStatementIdx();
711 Signal waitRel_directiveHandler(
const FpySequencer_WaitRelDirective& directive,
DirectiveError& error);
712 Signal waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error);
713 Signal goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error);
715 Signal noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error);
716 Signal storeTlmVal_directiveHandler(
const FpySequencer_StoreTlmValDirective& directive,
DirectiveError& error);
717 Signal pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
719 Signal storePrm_directiveHandler(
const FpySequencer_StorePrmDirective& directive,
DirectiveError& error);
720 Signal constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error);
721 Signal stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error);
773 Signal exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error);
774 Signal allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error);
775 Signal store_directiveHandler(
const FpySequencer_StoreDirective& directive,
DirectiveError& error);
776 Signal load_directiveHandler(
const FpySequencer_LoadDirective& directive,
DirectiveError& error);
777 Signal pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error);
778 Signal discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error);
779 Signal memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error);
780 Signal stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error);
781 Signal pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error);
782 Signal setFlag_directiveHandler(
const FpySequencer_SetFlagDirective& directive,
DirectiveError& error);
783 Signal getFlag_directiveHandler(
const FpySequencer_GetFlagDirective& directive,
DirectiveError& error);
sets the index of the next directive to execute
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.
void directive_storePrm_internalInterfaceHandler(const Svc::FpySequencer_StorePrmDirective &directive) override
Internal interface handler for directive_storePrm.
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
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 ...
FpySequencer_WaitRelDirective waitRel
SmId
State machine identifiers.
FpySequencer_WaitAbsDirective waitAbs
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_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_PushTlmValAndTimeDirective pushTlmValAndTime
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive) override
Internal interface handler for directive_allocate.
stores a prm buffer in the lvar array
void directive_storeTlmVal_internalInterfaceHandler(const Svc::FpySequencer_StoreTlmValDirective &directive) override
Internal interface handler for directive_storeTlmVal.
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_DirectiveErrorCode DirectiveError
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.
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
External serialize buffer with no copy semantics.
#define FW_TLM_BUFFER_MAX_SIZE
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.
bool Svc_FpySequencer_SequencerStateMachine_guard_shouldBreak(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
#define FW_PARAM_BUFFER_MAX_SIZE
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.
pops some bytes off the stack and puts them in lvar array
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
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
FpySequencer_StorePrmDirective storePrm
pushes a const byte array onto stack
RateGroupDivider component implementation.
FpySequencer_SetFlagDirective setFlag
Defines a base class for a memory allocator for classes.
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
stores a tlm buffer in the lvar array
Auto-generated base for FpySequencer component.
pushes some empty bytes to the stack
FpySequencer_StoreTlmValDirective storeTlmVal
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
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
FpySequencer(const char *const compName)