9 #include <config/CommandDispatcherImplCfg.hpp> 22 m_sequenceFilePath(
"<invalid_seq>"),
25 m_totalExpectedArgSize(0),
26 m_sequenceBlockState(),
31 m_sequencesStarted(0),
32 m_statementsDispatched(0),
49 this->RUN_ARGS_cmdHandler(opCode, cmdSeq, fileName, block,
Svc::SeqArgs{0, 0});
52 void FpySequencer ::RUN_ARGS_cmdHandler(
FwOpcodeType opCode,
67 this->m_savedOpCode = opCode;
68 this->m_savedCmdSeq = cmdSeq;
83 void FpySequencer::VALIDATE_cmdHandler(
FwOpcodeType opCode,
87 this->VALIDATE_ARGS_cmdHandler(opCode, cmdSeq, fileName,
Svc::SeqArgs{0, 0});
93 void FpySequencer ::VALIDATE_ARGS_cmdHandler(
FwOpcodeType opCode,
106 this->m_savedOpCode = opCode;
107 this->m_savedCmdSeq = cmdSeq;
114 void FpySequencer::RUN_VALIDATED_cmdHandler(
FwOpcodeType opCode,
116 const BlockState& block
127 this->m_savedOpCode = opCode;
128 this->m_savedCmdSeq = cmdSeq;
132 FpySequencer_SequenceExecutionArgs(this->m_sequenceFilePath, block, this->m_sequenceArgs));
143 void FpySequencer::CANCEL_cmdHandler(
FwOpcodeType opCode,
165 void FpySequencer::SET_BREAKPOINT_cmdHandler(
FwOpcodeType opCode,
180 void FpySequencer::BREAK_cmdHandler(
FwOpcodeType opCode,
198 void FpySequencer::CONTINUE_cmdHandler(
FwOpcodeType opCode,
216 void FpySequencer::CLEAR_BREAKPOINT_cmdHandler(
FwOpcodeType opCode,
246 void FpySequencer::DUMP_STACK_TO_FILE_cmdHandler(
FwOpcodeType opCode,
265 status = sequenceFile.
write(this->m_runtime.stack.bytes, writeSize);
316 U16 sequenceIndex =
static_cast<U16
>((cmdUid & 0xFFFF0000) >> 16);
317 U16 currentSequenceIndex =
static_cast<U16
>(this->m_sequencesStarted & 0xFFFF);
320 if (sequenceIndex != currentSequenceIndex) {
322 sequenceIndex, currentSequenceIndex);
340 this->m_runtime.currentStatementOpcode);
346 if (opCode != this->m_runtime.currentCmdOpcode) {
360 U16 cmdIndex =
static_cast<U16
>(cmdUid & 0xFFFF);
362 FW_ASSERT(this->m_statementsDispatched > 0);
363 U16 currentCmdIndex =
static_cast<U16
>((this->m_statementsDispatched) & 0xFFFF);
365 if (cmdIndex != currentCmdIndex) {
385 this->m_runtime.stack.push(static_cast<Fw::CmdResponse::SerialType>(response.
e));
430 this->updateDebugTelemetryStruct();
439 void FpySequencer::updateDebugTelemetryStruct() {
442 if (this->m_runtime.nextStatementIndex >= this->m_sequenceObj.get_header().get_statementCount()) {
444 this->m_debug.reachedEndOfFile =
true;
445 this->m_debug.nextStatementReadSuccess =
false;
446 this->m_debug.nextStatementOpcode = 0;
447 this->m_debug.nextCmdOpcode = 0;
448 this->m_debug.nextStatementIndex = this->m_runtime.nextStatementIndex;
449 this->m_debug.stackSize = this->m_runtime.stack.size;
454 static_cast<FwAssertArgType>(this->m_runtime.nextStatementIndex));
455 const Fpy::Statement& nextStmt = this->m_sequenceObj.
get_statements()[this->m_runtime.nextStatementIndex];
456 DirectiveUnion directiveUnion;
457 Fw::Success status = this->deserializeDirective(nextStmt, directiveUnion);
460 this->m_debug.reachedEndOfFile =
false;
461 this->m_debug.nextStatementReadSuccess =
false;
462 this->m_debug.nextStatementOpcode = nextStmt.get_opCode();
463 this->m_debug.nextCmdOpcode = 0;
464 this->m_debug.nextStatementIndex = this->m_runtime.nextStatementIndex;
465 this->m_debug.stackSize = this->m_runtime.stack.size;
471 this->m_debug.reachedEndOfFile =
false;
472 this->m_debug.nextStatementReadSuccess =
true;
473 this->m_debug.nextStatementOpcode = nextStmt.get_opCode();
474 this->m_debug.nextCmdOpcode = directiveUnion.constCmd.get_opCode();
475 this->m_debug.nextStatementIndex = this->m_runtime.nextStatementIndex;
476 this->m_debug.stackSize = this->m_runtime.stack.size;
480 this->m_debug.reachedEndOfFile =
false;
481 this->m_debug.nextStatementReadSuccess =
true;
482 this->m_debug.nextStatementOpcode = nextStmt.get_opCode();
483 this->m_debug.nextCmdOpcode = 0;
484 this->m_debug.nextStatementIndex = this->m_runtime.nextStatementIndex;
485 this->m_debug.stackSize = this->m_runtime.stack.size;
489 this->m_debug.reachedEndOfFile =
false;
490 this->m_debug.nextStatementReadSuccess =
false;
491 this->m_debug.nextStatementOpcode = 0;
492 this->m_debug.nextCmdOpcode = 0;
493 this->m_debug.nextStatementIndex = 0;
494 this->m_debug.stackSize = 0;
514 FW_ASSERT(
false, static_cast<FwAssertArgType>(
id));
521 bool FpySequencer::isRunningState(
State state) {
constexpr FwOpcodeType getEventOpcode(const FwOpcodeType opcode)
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
FwIdType FwOpcodeType
The type of a command opcode.
void tlmWrite_Debug_NextStatementOpcode(U8 arg, Fw::Time _tlmTime=Fw::Time())
#define FW_PARAM_OK(paramValid)
PlatformSizeType FwSizeType
void sequencer_sendSignal_cmd_STEP()
Send signal cmd_STEP to state machine sequencer.
void sequencer_sendSignal_cmd_SET_BREAKPOINT(const Svc::FpySequencer_BreakpointArgs &value)
Send signal cmd_SET_BREAKPOINT to state machine sequencer.
sequencer is ready to load, validate and run a sequence
void tlmWrite_Debug_ReachedEndOfFile(bool arg, Fw::Time _tlmTime=Fw::Time())
void pingIn_handler(FwIndexType portNum, U32 key) override
Handler for input port pingIn.
FwIdType FwPrmIdType
The type of a parameter identifier.
sequencer is not taking any action, waiting for a time in the future to continue
enum T e
The raw enum value.
void sequencer_sendSignal_stmtResponse_success()
Send signal stmtResponse_success to state machine sequencer.
void tlmWrite_Debug_StackSize(Svc::Fpy::StackSizeType arg, Fw::Time _tlmTime=Fw::Time())
void sequencer_sendSignal_cmd_VALIDATE(const Svc::FpySequencer_SequenceExecutionArgs &value)
Send signal cmd_VALIDATE to state machine sequencer.
sequencer is stepping into a single statement and dispatching it
Enum representing a command response.
void tlmWrite_State(FwEnumStoreType arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_SequencesSucceeded(U64 arg, Fw::Time _tlmTime=Fw::Time())
void sequencer_sendSignal_stmtResponse_unexpected()
Send signal stmtResponse_unexpected to state machine sequencer.
void sequencer_sendSignal_cmd_BREAK()
Send signal cmd_BREAK to state machine sequencer.
void tlmWrite_PRM_STATEMENT_TIMEOUT_SECS(F32 arg, Fw::Time _tlmTime=Fw::Time())
Svc_FpySequencer_SequencerStateMachine::State sequencer_getState() const
Get the state of state machine instance sequencer.
void log_WARNING_HI_WrongCmdResponseIndex(FwOpcodeType opcode, const Fw::CmdResponse &response, U16 actualCmdIdx, U16 expectedCmdIdx) const
Log event WrongCmdResponseIndex.
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
void tlmWrite_StatementsFailed(U64 arg, Fw::Time _tlmTime=Fw::Time())
void parametersLoaded() override
Called whenever parameters are loaded.
sequencer has validated the sequence and is waiting for a command to run it
F32 paramGet_STATEMENT_TIMEOUT_SECS(Fw::ParamValid &valid)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_handler(FwIndexType portNum, U32 context) override
Handler for input port tlmWrite.
void tlmWrite_DirectiveErrorId(const Svc::Fpy::DirectiveId &arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_Debug_NextCmdOpcode(FwOpcodeType arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_PRM_SEQ_BASE_DIR(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time())
void sequencer_sendSignal_cmd_RUN_VALIDATED(const Svc::FpySequencer_SequenceExecutionArgs &value)
Send signal cmd_RUN_VALIDATED to state machine sequencer.
Sequencer blocking state.
void sequencer_sendSignal_checkTimersIn()
Send signal checkTimersIn to state machine sequencer.
void tlmWrite_StatementsDispatched(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_LastDirectiveError(const Svc::Fpy::DirectiveErrorCode &arg, Fw::Time _tlmTime=Fw::Time())
void parameterUpdated(FwPrmIdType id) override
Called whenever a parameter is updated.
Type_of_statements & get_statements()
Get member statements.
Status write(const U8 *buffer, FwSizeType &size)
write data to this file from the supplied buffer bounded by size
void tlmWrite_Debug_NextStatementIndex(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_CmdResponseWhileNotAwaiting(FwOpcodeType opcode, const Fw::CmdResponse &response) const
Log event CmdResponseWhileNotAwaiting.
const char * toChar() const
Convert to a C-style char*.
enum T e
The raw enum value.
void log_WARNING_HI_InvalidSeqRunCall(I32 state) const
Log event InvalidSeqRunCall.
Command successfully executed.
void log_WARNING_HI_FileOpenError(const Fw::StringBase &filePath, I32 errorCode) const
Log event FileOpenError.
void seqCancelIn_handler(FwIndexType portNum) override
Command had execution error.
void sequencer_sendSignal_cmd_CANCEL()
Send signal cmd_CANCEL to state machine sequencer.
void log_WARNING_HI_InvalidCommand(I32 state) const
Log event InvalidCommand.
void tlmWrite_BreakBeforeNextLine(bool arg, Fw::Time _tlmTime=Fw::Time())
void log_ACTIVITY_HI_BreakpointCleared() const
Log event BreakpointCleared.
void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) override
Handler for input port cmdResponseIn.
Fw::ParamString paramGet_SEQ_BASE_DIR(Fw::ParamValid &valid)
void tlmWrite_SequencesFailed(U64 arg, Fw::Time _tlmTime=Fw::Time())
void checkTimers_handler(FwIndexType portNum, U32 context) override
Handler for input port checkTimers.
void tlmWrite_SeqPath(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time())
PlatformIndexType FwIndexType
void sequencer_sendSignal_cmd_CLEAR_BREAKPOINT()
Send signal cmd_CLEAR_BREAKPOINT to state machine sequencer.
void log_WARNING_HI_CmdResponseWhileAwaitingDirective(FwOpcodeType opcode, const Fw::CmdResponse &response, U8 expectedDirectiveOpcode) const
Log event CmdResponseWhileAwaitingDirective.
void log_WARNING_HI_InvalidSeqCancelCall(I32 state) const
Log event InvalidSeqCancelCall.
void tlmWrite_DirectiveErrorIndex(U64 arg, Fw::Time _tlmTime=Fw::Time())
RateGroupDivider component implementation.
Enum representing parameter validity.
void sequencer_sendSignal_cmd_CONTINUE()
Send signal cmd_CONTINUE to state machine sequencer.
void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args) override
Handler for input port seqRunIn.
void log_WARNING_LO_CmdResponseWhileNotRunningSequence(I32 state, FwOpcodeType opcode, const Fw::CmdResponse &response) const
Log event CmdResponseWhileNotRunningSequence.
void log_WARNING_HI_WrongCmdResponseOpcode(FwOpcodeType opcode, const Fw::CmdResponse &response, FwOpcodeType expectedOpcode) const
Log event WrongCmdResponseOpcode.
Auto-generated base for FpySequencer component.
void sequencer_sendSignal_cmd_RUN(const Svc::FpySequencer_SequenceExecutionArgs &value)
Send signal cmd_RUN to state machine sequencer.
void log_WARNING_HI_FileWriteError(FwSizeType writeSize, const Fw::StringBase &filePath, I32 errorCode) const
Log event FileWriteError.
void log_WARNING_LO_CmdResponseFromOldSequence(FwOpcodeType opcode, const Fw::CmdResponse &response, U16 oldSequenceIdx, U16 currentSequenceIdx) const
Log event CmdResponseFromOldSequence.
void tlmWrite_BreakOnlyOnceOnBreakpoint(bool arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_SequencesCancelled(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_BreakpointInUse(bool arg, Fw::Time _tlmTime=Fw::Time())
FpySequencer(const char *const compName)
void tlmWrite_BreakpointIndex(U32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_Debug_NextStatementReadSuccess(bool arg, Fw::Time _tlmTime=Fw::Time())