-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add args to CmdSeqIn #4962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Add args to CmdSeqIn #4962
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,25 +6,32 @@ async command RUN( | |
| ) \ | ||
| opcode 0 priority 7 assert | ||
|
|
||
| async command RUN_ARGS( | ||
| fileName: string size FileNameStringSize @< The name of the sequence file | ||
| $block: BlockState @< Return command status when complete or not | ||
| buffer: Svc.SeqArgs @< Arguments to pass to the sequencer | ||
| ) \ | ||
| opcode 1 priority 7 assert | ||
|
|
||
| @ Loads and validates a sequence | ||
| # prio: lower than sm sig and CANCEL | ||
| async command VALIDATE( | ||
| fileName: string size FileNameStringSize @< The name of the sequence file | ||
| ) \ | ||
| opcode 1 priority 7 assert | ||
| opcode 2 priority 7 assert | ||
|
|
||
| @ Must be called after VALIDATE. Runs the sequence that was validated. | ||
| # prio: lower than sm sig and CANCEL | ||
| async command RUN_VALIDATED( | ||
| $block: BlockState @< Return command status when complete or not | ||
| ) \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command needs an argument buf too. And that would mean that we'd need a RUN_VALIDATED_ARGS command. However, I think it would be okay to skip this for now, because this command is not used frequently. Please make a github issue to track adding the args buf to this command when we fix the GDS. |
||
| opcode 2 priority 7 assert | ||
| opcode 3 priority 7 assert | ||
|
|
||
| @ Cancels a running or validated sequence. After running CANCEL, the sequencer | ||
| @ should return to IDLE | ||
| # less prio than sm sig, but higher than everything else | ||
| async command CANCEL() \ | ||
| opcode 3 priority 8 assert | ||
| opcode 4 priority 8 assert | ||
|
|
||
| @ Sets the breakpoint which will pause the execution of the sequencer when | ||
| @ reached, until unpaused by the CONTINUE command. Will pause just before | ||
|
|
@@ -34,31 +41,31 @@ async command SET_BREAKPOINT( | |
| stmtIdx: U32 @< The directive index to pause execution before. | ||
| breakOnce: bool @< Whether or not to break only once at this breakpoint | ||
| ) \ | ||
| opcode 4 priority 7 assert | ||
| opcode 5 priority 7 assert | ||
|
|
||
| @ Pauses the execution of the sequencer, just before it is about to dispatch the next directive, | ||
| @ until unpaused by the CONTINUE command, or stepped by the STEP command. This command is only valid | ||
| @ substates of the RUNNING state that are not RUNNING.PAUSED. | ||
| async command BREAK() \ | ||
| opcode 5 priority 7 assert | ||
| opcode 6 priority 7 assert | ||
|
|
||
| @ Continues the automatic execution of the sequence after it has been paused. If a breakpoint is still | ||
| @ set, it may pause again on that breakpoint. This command is only valid in the RUNNING.PAUSED state. | ||
| async command CONTINUE() \ | ||
| opcode 6 priority 7 assert | ||
| opcode 7 priority 7 assert | ||
|
|
||
| @ Clears the breakpoint, but does not continue executing the sequence. This command | ||
| @ is valid in all states. This happens automatically when a sequence ends execution. | ||
| async command CLEAR_BREAKPOINT() \ | ||
| opcode 7 priority 7 assert | ||
| opcode 8 priority 7 assert | ||
|
|
||
| @ Dispatches and awaits the result of the next directive, or ends the sequence if no more directives remain. Returns | ||
| @ to the RUNNING.PAUSED state if the directive executes successfully. This command is only valid in the RUNNING.PAUSED state. | ||
| async command STEP() \ | ||
| opcode 8 priority 7 assert | ||
| opcode 9 priority 7 assert | ||
|
|
||
| @ Writes the contents of the stack to a file. This command is only valid in the RUNNING.PAUSED state. | ||
| async command DUMP_STACK_TO_FILE( | ||
| fileName: string size FileNameStringSize @< The name of the output file | ||
| ) \ | ||
| opcode 9 priority 7 assert | ||
| opcode 10 priority 7 assert | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,6 +255,34 @@ void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_incrementSequen | |
| this->m_sequencesStarted++; | ||
| } | ||
|
|
||
| //! Implementation for action pushArgsToStack of state machine Svc_FpySequencer_SequencerStateMachine | ||
| //! | ||
| //! pushes sequence arguments to the stack | ||
| void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack( | ||
| SmId smId, //!< The state machine id | ||
| Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| ) { | ||
| const Svc::SeqArgs& args = this->m_pendingSeqArgs; | ||
|
|
||
| // Early return if no arguments provided | ||
| if (args.get_size() == 0) { | ||
| return; | ||
| } | ||
|
|
||
| Fpy::StackSizeType availableSpace = Fpy::MAX_STACK_SIZE - this->m_runtime.stack.size; | ||
|
|
||
| if (args.get_size() > availableSpace) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way this PR is currently implemented, sendSignal_result_failure does not do what you expect it does here. It actually would do nothing, and the FSW would try to run the sequence. Could be quite bad. This is because, when this action is called, you're in the RUN state. Homework for you: make sure you know which signals do what in the RUN state. Many signals won't do anything. Once you make the modification I mentioned regarding the SequenceExecutionArgs, this function will just set the m_pendingSeqArgs blindly. See action_setSequenceFilePath. Then, the size check will go in the FpySequencer::validate method. You can just return Fw::Success::FAILURE. Please also add a unit test for this case. |
||
| // Args too large - fail the sequence gracefully. | ||
| this->sequencer_sendSignal_result_failure(); | ||
| return; | ||
| } | ||
|
|
||
| // Push args buffer to stack. Args are already serialized in big-endian format | ||
| // by F' serialization system, so no endianness conversion is needed. | ||
| this->m_runtime.stack.push(args.get_buffer(), | ||
| static_cast<Fpy::StackSizeType>(args.get_size())); | ||
| } | ||
|
|
||
| //! Implementation for action clearSequenceFile of state machine Svc_FpySequencer_SequencerStateMachine | ||
| //! | ||
| //! clears all variables related to the loading/validating of the sequence file | ||
|
|
@@ -343,8 +371,8 @@ void FpySequencer::Svc_FpySequencer_SequencerStateMachine_action_report_seqStart | |
| Svc_FpySequencer_SequencerStateMachine::Signal signal //!< The signal | ||
| ) { | ||
| if (this->isConnected_seqStartOut_OutputPort(0)) { | ||
| // report that the sequence started to internal callers | ||
| this->seqStartOut_out(0, this->m_sequenceFilePath); | ||
| // report that the sequence started to internal callers with the actual args | ||
| this->seqStartOut_out(0, this->m_sequenceFilePath, this->m_pendingSeqArgs); | ||
| } | ||
| } | ||
| // ---------------------------------------------------------------------- | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a cleaner way of passing around the pending sequence arguments without adding new state.
I described it in an earlier comment: