7 #ifndef FpySequencer_HPP 8 #define FpySequencer_HPP 30 "Sequence arg count must be below U8 max");
32 "Sequence statement count must be below U16 max");
34 "Max stack size must be below Svc::Fpy::StackSizeType max");
36 "Max stack size must be greater than max tlm buffer size");
38 "Max stack size must be greater than max prm buffer size");
103 template <
typename T>
256 void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
264 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
273 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
282 void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
291 void Svc_FpySequencer_SequencerStateMachine_action_validate(
299 void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
307 void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
315 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
323 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
331 void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
339 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
348 void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
356 void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
364 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
372 void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
380 void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
388 void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
396 void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
404 void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
412 void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
420 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
428 void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
436 void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
445 void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
453 void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
461 void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
469 void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
641 static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
677 U64 m_sequencesStarted;
680 U64 m_statementsDispatched;
689 U32 nextStatementIndex = 0;
704 bool rngSeeded =
false;
706 Stack stack = Stack();
711 struct BreakpointInfo {
713 bool breakpointInUse =
false;
715 bool breakOnlyOnceOnBreakpoint =
false;
717 U32 breakpointIndex = 0;
721 bool breakBeforeNextLine =
false;
728 bool reachedEndOfFile =
false;
730 bool nextStatementReadSuccess =
false;
732 U8 nextStatementOpcode = 0;
736 U32 nextStatementIndex = 0;
745 U64 statementsFailed = 0;
747 U64 sequencesSucceeded = 0;
749 U64 sequencesFailed = 0;
751 U64 sequencesCancelled = 0;
756 U64 directiveErrorIndex = 0;
784 const FpySequencer_FileReadStage& readStage,
785 bool updateCrc =
true);
792 void handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err);
795 Signal dispatchStatement();
800 Fw::Success deserializeDirective(
const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
803 void dispatchDirective(
const DirectiveUnion& directive,
const Fpy::DirectiveId&
id);
806 Signal checkStatementTimeout();
812 bool isRunningState(
State state);
815 void updateDebugTelemetryStruct();
822 void sendSignal(
Signal signal);
828 U32 currentStatementIdx();
832 Signal waitRel_directiveHandler(
const FpySequencer_WaitRelDirective& directive,
DirectiveError& error);
833 Signal waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error);
834 Signal goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error);
836 Signal noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error);
837 Signal pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
DirectiveError& error);
838 Signal pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
840 Signal pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error);
841 Signal constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error);
842 Signal stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error);
894 Signal exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error);
895 Signal allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error);
900 Signal storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
902 Signal loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error);
903 Signal pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error);
904 Signal discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error);
905 Signal memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error);
906 Signal stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error);
907 Signal pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error);
908 Signal setSeed_directiveHandler(
const FpySequencer_SetSeedDirective& directive,
DirectiveError& error);
909 Signal pushRand_directiveHandler(
const FpySequencer_PushRandDirective& directive,
DirectiveError& error);
910 Signal getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error);
911 Signal peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error);
912 Signal storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error);
913 Signal call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error);
914 Signal return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error);
915 Signal loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error);
916 Signal storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error);
917 Signal storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
919 Signal popEvent_directiveHandler(
const FpySequencer_PopEventDirective& directive,
DirectiveError& error);
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.
pushes the next RNG value to the stack
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
void directive_setSeed_internalInterfaceHandler(const Svc::FpySequencer_SetSeedDirective &directive) override
Internal interface handler for directive_setSeed.
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
FpySequencer_PopEventDirective popEvent
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 directive_pushRand_internalInterfaceHandler(const Svc::FpySequencer_PushRandDirective &directive) override
Internal interface handler for directive_pushRand.
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.
pops a severity and message from the stack and emits an F Prime event
void pushZeroes(Fpy::StackSizeType byteCount)
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.
Sequencer blocking state.
FpySequencer_PushRandDirective pushRand
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
A generic interface for creating and comparing hash values.
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 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
void directive_popEvent_internalInterfaceHandler(const Svc::FpySequencer_PopEventDirective &directive) override
Internal interface handler for directive_popEvent.
generic stack operation handler
void seqCancelIn_handler(FwIndexType portNum) override
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
pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
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
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 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
FpySequencer_ExitDirective exit
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)