F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FpySequencer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FpySequencer.hpp
3 // \author zimri.leisher
4 // \brief hpp file for FpySequencer component implementation class
5 // ======================================================================
6 
7 #ifndef FpySequencer_HPP
8 #define FpySequencer_HPP
9 
10 #include <atomic>
11 #include <random>
14 #include "Fw/Types/StringBase.hpp"
16 #include "Fw/Types/WaitEnumAc.hpp"
17 #include "Os/File.hpp"
18 #include "Os/FilePathUtils.hpp"
28 #include "Utils/Hash/Hash.hpp"
30 
31 static_assert(Svc::Fpy::MAX_SEQUENCE_ARG_COUNT <= std::numeric_limits<U8>::max(),
32  "Sequence arg count must be below U8 max");
33 static_assert(Svc::Fpy::MAX_SEQUENCE_STATEMENT_COUNT <= std::numeric_limits<U16>::max(),
34  "Sequence statement count must be below U16 max");
35 static_assert(Svc::Fpy::MAX_STACK_SIZE <= std::numeric_limits<Svc::Fpy::StackSizeType>::max(),
36  "Max stack size must be below Svc::Fpy::StackSizeType max");
37 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_TLM_BUFFER_MAX_SIZE),
38  "Max stack size must be greater than max tlm buffer size");
39 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_PARAM_BUFFER_MAX_SIZE),
40  "Max stack size must be greater than max prm buffer size");
41 
42 namespace Svc {
43 
47 
49  friend class FpySequencerTester;
50 
51  public:
84 
87  };
88 
89  class Stack {
90  public:
91  // the byte array of the program stack, storing lvars, operands and function calls
93  // how many bytes high the stack is
95  // the byte offset from the start of the stack where the current function's local variables begin.
96  // analogous to a 'frame pointer'.
98 
99  // pops a value off of the top of the stack
100  // converts it from big endian
101  template <typename T>
102  T pop();
103 
104  // pushes a value onto the top of the stack
105  // converts it to big endian
106  template <typename T>
107  void push(T val);
108 
109  // pops a byte array from the top of the stack into the destination array
110  // does not convert endianness
111  void pop(U8* dest, Fpy::StackSizeType size);
112 
113  // pushes a byte array to the top of the stack from the source array
114  // leaves the source array unmodified
115  // does not convert endianness
116  void push(const U8* src, Fpy::StackSizeType size);
117 
118  // pushes zero bytes to the stack
119  void pushZeroes(Fpy::StackSizeType byteCount);
120 
121  // returns a pointer to the next unused byte at the top of the stack
122  U8* top();
123 
124  // Copies data from one region of the stack to another
125  // Asserts that both regions are within bounds and do not overlap
126  // Does not modify stack size
127  void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize);
128 
129  // Moves data within the stack (handles overlapping regions)
130  // Asserts that both source and destination are within bounds
131  // Does not modify stack size
132  void move(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType moveSize);
133  };
134 
135  // ----------------------------------------------------------------------
136  // Construction, initialization, and destruction
137  // ----------------------------------------------------------------------
138 
141  FpySequencer(const char* const compName
142  );
143 
146  ~FpySequencer();
147 
148  private:
152  void RUN_cmdHandler(FwOpcodeType opCode,
153  U32 cmdSeq,
154  const Fw::CmdStringArg& fileName,
155  const Svc::BlockState& block
156  ) override;
157 
159  void RUN_ARGS_cmdHandler(FwOpcodeType opCode,
160  U32 cmdSeq,
161  const Fw::CmdStringArg& fileName,
162  const Svc::BlockState& block,
163  const Svc::SeqArgs& args
164  ) override;
165 
169  void VALIDATE_cmdHandler(FwOpcodeType opCode,
170  U32 cmdSeq,
171  const Fw::CmdStringArg& fileName
172  ) override;
173 
177  void VALIDATE_ARGS_cmdHandler(FwOpcodeType opCode,
178  U32 cmdSeq,
179  const Fw::CmdStringArg& fileName,
180  const Svc::SeqArgs& buffer
181  ) override;
182 
186  void RUN_VALIDATED_cmdHandler(FwOpcodeType opCode,
187  U32 cmdSeq,
188  const Svc::BlockState& block
189  ) override;
190 
194  void CANCEL_cmdHandler(FwOpcodeType opCode,
195  U32 cmdSeq
196  ) override;
197 
204  void SET_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
205  U32 cmdSeq,
206  U32 stmtIdx,
207  bool breakOnce
208  ) override;
209 
215  void BREAK_cmdHandler(FwOpcodeType opCode,
216  U32 cmdSeq
217  ) override;
218 
223  void CONTINUE_cmdHandler(FwOpcodeType opCode,
224  U32 cmdSeq
225  ) override;
226 
231  void CLEAR_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
232  U32 cmdSeq
233  ) override;
234 
240  void STEP_cmdHandler(FwOpcodeType opCode,
241  U32 cmdSeq
242  ) override;
243 
247  void DUMP_STACK_TO_FILE_cmdHandler(FwOpcodeType opCode,
248  U32 cmdSeq,
249  const Fw::CmdStringArg& fileName
250  ) override;
251 
252  // ----------------------------------------------------------------------
253  // Functions to implement for internal state machine actions
254  // ----------------------------------------------------------------------
255 
259  void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
260  SmId smId,
262  ) override;
263 
267  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
268  SmId smId,
271  ) override;
272 
276  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
277  SmId smId,
280  ) override;
281 
285  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
286  SmId smId,
289  ) override;
290 
294  void Svc_FpySequencer_SequencerStateMachine_action_validate(
295  SmId smId,
297  ) override;
298 
302  void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
303  SmId smId,
305  ) override;
306 
310  void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
311  SmId smId,
313  ) override;
314 
318  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
319  SmId smId,
321  ) override;
322 
326  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
327  SmId smId,
329  ) override;
330 
334  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
335  SmId smId,
337  ) override;
338 
342  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
343  SmId smId,
345  ) override;
346 
351  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
352  SmId smId,
354  ) override;
355 
359  void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
360  SmId smId,
362  ) override;
363 
367  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
368  SmId smId,
370  ) override;
371 
375  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
376  SmId smId,
378  ) override;
379 
383  void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
384  SmId smId,
386  ) override;
387 
391  void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
392  SmId smId,
394  ) override;
395 
399  void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
400  SmId smId,
402  ) override;
403 
407  void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
408  SmId smId,
410  ) override;
411 
415  void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
416  SmId smId,
418  ) override;
419 
423  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
424  SmId smId,
426  ) override;
427 
431  void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
432  SmId smId,
434  ) override;
435 
439  void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
440  SmId smId,
443  ) override;
444 
448  void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
449  SmId smId,
451  ) override;
452 
456  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
457  SmId smId,
459  ) override;
460 
464  void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
465  SmId smId,
467  ) override;
468 
472  void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
473  SmId smId,
475  ) override;
476 
477  protected:
478  // ----------------------------------------------------------------------
479  // Functions to implement for internal state machine guards
480  // ----------------------------------------------------------------------
481 
486  SmId smId,
488  ) const override;
489 
495  SmId smId,
497  ) const override;
498 
503  SmId smId,
505  ) const override;
506 
507  // ----------------------------------------------------------------------
508  // Handlers to implement for typed input ports
509  // ----------------------------------------------------------------------
510 
512  void checkTimers_handler(FwIndexType portNum,
513  U32 context
514  ) override;
515 
517  void cmdResponseIn_handler(FwIndexType portNum,
518  FwOpcodeType opCode,
519  U32 cmdSeq,
520  const Fw::CmdResponse& response
521  ) override;
522 
524  void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename, const Svc::SeqArgs& args) override;
525 
529  void seqCancelIn_handler(FwIndexType portNum
530  ) override;
531 
533  void pingIn_handler(FwIndexType portNum,
534  U32 key
535  ) override;
536 
538  void tlmWrite_handler(FwIndexType portNum,
539  U32 context
540  ) override;
541 
544 
547 
549  void tlmWriteInternal_overflowHook() override;
550 
553  U64 sequenceIndex) override;
554 
557  U64 sequenceIndex) override;
558 
561  U64 sequenceIndex) override;
562 
565  U64 sequenceIndex) override;
566 
569  U64 sequenceIndex) override;
570 
573  U64 sequenceIndex) override;
574 
578  U64 sequenceIndex) override;
579 
582  U64 sequenceIndex) override;
583 
586  U64 sequenceIndex) override;
587 
590  U64 sequenceIndex) override;
591 
594  U64 sequenceIndex) override;
595 
598  U64 sequenceIndex) override;
599 
603  U64 sequenceIndex) override;
604 
607  U64 sequenceIndex) override;
608 
611  U64 sequenceIndex) override;
612 
615  U64 sequenceIndex) override;
616 
619  U64 sequenceIndex) override;
620 
623  U64 sequenceIndex) override;
624 
627  U64 sequenceIndex) override;
628 
631  U64 sequenceIndex) override;
632 
635  U64 sequenceIndex) override;
636 
639  U64 sequenceIndex) override;
640 
643  U64 sequenceIndex) override;
644 
647  U64 sequenceIndex) override;
648 
651  U64 sequenceIndex) override;
652 
655  U64 sequenceIndex) override;
656 
659  U64 sequenceIndex) override;
660 
663  U64 sequenceIndex) override;
664 
668  U64 sequenceIndex) override;
669 
672  U64 sequenceIndex) override;
673 
676  U64 sequenceIndex) override;
677 
678  void parametersLoaded() override;
679  void parameterUpdated(FwPrmIdType id) override;
680 
681  public:
682  void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator& allocator, FwSizeType bytes);
683 
684  void deallocateBuffer(Fw::MemAllocator& allocator);
685 
691  void configureSandbox(const char* directory);
692 
693  private:
694  static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
695 
699  bool checkSandbox(const Fw::StringBase& fileName);
700 
701  // allocated at startup
702  Fw::ExternalSerializeBuffer m_sequenceBuffer;
703  // id of allocator that gave us m_sequenceBuffer
704  FwEnumStoreType m_allocatorId;
705 
706  // assigned by the user via cmd
707  // length is FileNameStringSize
708  Fw::FileNameString m_sequenceFilePath;
709  // the sequence, loaded in memory
710  Fpy::Sequence m_sequenceObj;
711  // live running computation of CRC (updated as we read)
712  Utils::Hash m_computedCRC;
713 
714  // Size of arguments read in current sequence. Used for validation between
715  // User provided arguments and what is requested of the sequence.
716  Fpy::StackSizeType m_totalExpectedArgSize;
717 
718  // whether or not the sequence we're about to run should return immediately or
719  // block on completion
720  Svc::BlockState m_sequenceBlockState;
721  // if we are to block on completion, save the opCode and cmdSeq we should
722  // return
723  FwOpcodeType m_savedOpCode;
724  U32 m_savedCmdSeq;
725 
726  // sequence arguments to push to stack when entering RUNNING state
727  Svc::SeqArgs m_sequenceArgs{};
728 
729  // the goal state is the state that we're trying to reach in the sequencer
730  // if it's RUNNING, then we should promptly go to RUNNING once we validate the
731  // sequence. if it's VALID, we should wait after VALIDATING
732  FpySequencer_GoalState m_goalState;
733 
734  // the total number of sequences this sequencer has started since construction
735  U64 m_sequencesStarted;
736  // the total number of statements this sequencer has dispatched, successfully or
737  // otherwise, since construction
738  U64 m_statementsDispatched;
739 
740  const Fw::String NO_SEQ{"<no seq>"};
741 
742  // true while a checkTimersInternal message is on the queue. set by the
743  // sync checkTimers handler, cleared by the internal handler
744  std::atomic<bool> m_checkTimersQueued;
745  // true while a tlmWriteInternal message is on the queue. set by the
746  // sync tlmWrite handler, cleared by the internal handler
747  std::atomic<bool> m_tlmWriteQueued;
748 
749  // the runtime state of the sequence. encapsulates all state
750  // needed to run the sequence.
751  // this is distinct from the state of the sequencer. the
752  // sequencer and all its state is really just a shell to load
753  // and execute this runtime.
754  struct Runtime {
755  // the index of the next statement to be executed
756  U32 nextStatementIndex = 0;
757 
758  // the opcode of the statement that is currently executing
759  U8 currentStatementOpcode = Fpy::DirectiveId::INVALID;
760  // the opcode of the command that we are currently awaiting, or 0 if we are executing a directive
761  FwOpcodeType currentCmdOpcode = 0;
762  // the time we dispatched the statement that is currently executing
763  Fw::Time currentStatementDispatchTime = Fw::Time();
764 
765  // the absolute time we should wait for until returning
766  // a statement response
767  Fw::Time wakeupTime = Fw::Time();
768 
769  // RNG state used by PUSH_RAND and SET_SEED directives during this run
770  std::mt19937 rng;
771  bool rngSeeded = false;
772 
773  Stack stack = Stack();
774  } m_runtime;
775 
776  // the state of the debugger. debugger is separate from runtime
777  // because it can be set up before running the sequence.
778  struct BreakpointInfo {
779  // whether or not to break at the debug breakpoint index
780  bool breakpointInUse = false;
781  // whether or not to remove the breakpoint after breaking on it
782  bool breakOnlyOnceOnBreakpoint = false;
783  // the statement index at which to break, before dispatching
784  U32 breakpointIndex = 0;
785  // whether or not to break before dispatching the next line,
786  // independent of what line it is.
787  // can be used in combination with breakpointIndex
788  bool breakBeforeNextLine = false;
789  } m_breakpoint;
790 
791  // debug information about the sequence. only valid in the PAUSED state
792  // which you can access via BREAK or SET_BREAKPOINT cmds
793  struct DebugInfo {
794  // true if there are no statements remaining in the sequence file
795  bool reachedEndOfFile = false;
796  // true if we were able to deserialize the next statement successfully
797  bool nextStatementReadSuccess = false;
798  // the opcode of the next statement to dispatch.
799  U8 nextStatementOpcode = 0;
800  // if the next statement is a cmd directive, the opcode of that cmd
801  FwOpcodeType nextCmdOpcode = 0;
802  // the index of the next statement we're going to execute
803  U32 nextStatementIndex = 0;
804  // the size of the stack. store this separately from the real stack size
805  // so we can avoid changing this during runtime, only modify it during
806  // debug
807  Fpy::StackSizeType stackSize = 0;
808  } m_debug;
809 
810  struct Telemetry {
811  // the number of statements that failed to execute
812  U64 statementsFailed = 0;
813  // the number of sequences successfully completed
814  U64 sequencesSucceeded = 0;
815  // the number of sequences that failed to validate or execute
816  U64 sequencesFailed = 0;
817  // the number of sequences that have been cancelled
818  U64 sequencesCancelled = 0;
819 
820  // the error code of the last directive that ran
821  DirectiveError lastDirectiveError = DirectiveError::NO_ERROR;
822  // the index of the last directive that errored
823  U64 directiveErrorIndex = 0;
824  // the opcode of the last directive that errored
825  Fpy::DirectiveId directiveErrorId = Fpy::DirectiveId::INVALID;
826  } m_tlm;
827 
828  // directory file access is restricted to (resolved, with trailing '/')
829  char m_sandboxDir[Os::FilePathUtils::MAX_PATH_LENGTH];
830  // whether configureSandbox() has been called; until then any path is allowed
831  bool m_sandboxConfigured;
832 
833  // ----------------------------------------------------------------------
834  // Validation state
835  // ----------------------------------------------------------------------
836 
837  // loads the sequence in memory, and does header/crc/integrity checks.
838  // return SUCCESS if sequence is valid, FAILURE otherwise
839  Fw::Success validate();
840  // reads and validates the header from the m_sequenceBuffer
841  // return SUCCESS if sequence is valid, FAILURE otherwise
842  Fw::Success readHeader();
843  // reads and validates the body from the m_sequenceBuffer
844  // return SUCCESS if sequence is valid, FAILURE otherwise
845  Fw::Success readBody();
846  // reads and validates the footer from the m_sequenceBuffer
847  // return SUCCESS if sequence is valid, FAILURE otherwise
848  Fw::Success readFooter();
849 
850  // reads some bytes from the open file into the m_sequenceBuffer.
851  // updates the CRC by default, but can be turned off if the contents
852  // aren't included in CRC.
853  // return success if successful
854  Fw::Success readBytes(Os::File& file,
855  FwSizeType readLen,
856  const FpySequencer_FileReadStage& readStage,
857  bool updateCrc = true);
858 
859  // ----------------------------------------------------------------------
860  // Run state
861  // ----------------------------------------------------------------------
862 
863  // utility method for updating telemetry based on a directive error code
864  void handleDirectiveErrorCode(Fpy::DirectiveId id, DirectiveError err);
865 
866  // dispatches the next statement
867  Signal dispatchStatement();
868 
869  // deserializes a directive from bytes into the Fpy type
870  // returns success if able to deserialize, and returns the Fpy type object
871  // as a reference, in a union of all the possible directive type objects
872  Fw::Success deserializeDirective(const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
873 
874  // dispatches a deserialized sequencer directive to the right handler.
875  void dispatchDirective(const DirectiveUnion& directive, const Fpy::DirectiveId& id);
876 
877  // checks whether the currently executing statement timed out
878  Signal checkStatementTimeout();
879 
880  // checks whether the sequencer should wake from sleeping
881  Signal checkShouldWake();
882 
883  // return true if state is a substate of RUNNING
884  bool isRunningState(State state);
885 
886  // return true if a directive dispatched by the given sequence can execute in the current state.
887  // otherwise, log a warning
888  bool checkDirectiveExpected(Fpy::DirectiveId directive, U64 sequenceIndex);
889 
890  // update a struct containing debug telemetry, or defaults if not in debug break
891  void updateDebugTelemetryStruct();
892 
893  // ----------------------------------------------------------------------
894  // Directives
895  // ----------------------------------------------------------------------
896 
897  // sends a signal based on a signal id
898  void sendSignal(Signal signal);
899 
900  // dispatches a command, returns whether successful or not
901  Fw::Success sendCmd(FwOpcodeType opcode, const U8* argBuf, FwSizeType argBufSize);
902 
903  // returns the index of the current statement
904  U32 currentStatementIdx();
905 
906  // we split these functions up into the internalInterfaceInvoke and these custom member funcs
907  // so that we can unit test them easier
908  Signal waitRel_directiveHandler(const FpySequencer_WaitRelDirective& directive, DirectiveError& error);
909  Signal waitAbs_directiveHandler(const FpySequencer_WaitAbsDirective& directive, DirectiveError& error);
910  Signal goto_directiveHandler(const FpySequencer_GotoDirective& directive, DirectiveError& error);
911  Signal if_directiveHandler(const FpySequencer_IfDirective& directive, DirectiveError& error);
912  Signal noOp_directiveHandler(const FpySequencer_NoOpDirective& directive, DirectiveError& error);
913  Signal pushTlmVal_directiveHandler(const FpySequencer_PushTlmValDirective& directive, DirectiveError& error);
914  Signal pushTlmValAndTime_directiveHandler(const FpySequencer_PushTlmValAndTimeDirective& directive,
915  DirectiveError& error);
916  Signal pushPrm_directiveHandler(const FpySequencer_PushPrmDirective& directive, DirectiveError& error);
917  Signal constCmd_directiveHandler(const FpySequencer_ConstCmdDirective& directive, DirectiveError& error);
918  Signal stackOp_directiveHandler(const FpySequencer_StackOpDirective& directive, DirectiveError& error);
919 
920  DirectiveError op_or();
921  DirectiveError op_and();
922  DirectiveError op_ieq();
923  DirectiveError op_ine();
924  DirectiveError op_ult();
925  DirectiveError op_ule();
926  DirectiveError op_ugt();
927  DirectiveError op_uge();
928  DirectiveError op_slt();
929  DirectiveError op_sle();
930  DirectiveError op_sgt();
931  DirectiveError op_sge();
932  DirectiveError op_feq();
933  DirectiveError op_fne();
934  DirectiveError op_flt();
935  DirectiveError op_fle();
936  DirectiveError op_fgt();
937  DirectiveError op_fge();
938  DirectiveError op_not();
939  DirectiveError op_fpext();
940  DirectiveError op_fptrunc();
941  DirectiveError op_fptoui();
942  DirectiveError op_fptosi();
943  DirectiveError op_sitofp();
944  DirectiveError op_uitofp();
945  DirectiveError op_add();
946  DirectiveError op_sub();
947  DirectiveError op_mul();
948  DirectiveError op_udiv();
949  DirectiveError op_sdiv();
950  DirectiveError op_umod();
951  DirectiveError op_smod();
952  DirectiveError op_fadd();
953  DirectiveError op_fsub();
954  DirectiveError op_fmul();
955  DirectiveError op_fdiv();
956  DirectiveError op_fpow();
957  DirectiveError op_flog();
958  DirectiveError op_fmod();
959  DirectiveError op_siext_8_64();
960  DirectiveError op_siext_16_64();
961  DirectiveError op_siext_32_64();
962  DirectiveError op_ziext_8_64();
963  DirectiveError op_ziext_16_64();
964  DirectiveError op_ziext_32_64();
965  DirectiveError op_itrunc_64_8();
966  DirectiveError op_itrunc_64_16();
967  DirectiveError op_itrunc_64_32();
968  DirectiveError op_ffloor();
969  DirectiveError op_iabs();
970  DirectiveError op_fabs();
971 
972  Signal exit_directiveHandler(const FpySequencer_ExitDirective& directive, DirectiveError& error);
973  Signal allocate_directiveHandler(const FpySequencer_AllocateDirective& directive, DirectiveError& error);
975  Signal storeHelper(Fpy::StackSizeType destOffset, Fpy::StackSizeType size, DirectiveError& error);
977  Signal loadHelper(Fpy::StackSizeType srcOffset, Fpy::StackSizeType size, DirectiveError& error);
978  Signal storeRelConstOffset_directiveHandler(const FpySequencer_StoreRelConstOffsetDirective& directive,
979  DirectiveError& error);
980  Signal loadRel_directiveHandler(const FpySequencer_LoadRelDirective& directive, DirectiveError& error);
981  Signal pushVal_directiveHandler(const FpySequencer_PushValDirective& directive, DirectiveError& error);
982  Signal discard_directiveHandler(const FpySequencer_DiscardDirective& directive, DirectiveError& error);
983  Signal memCmp_directiveHandler(const FpySequencer_MemCmpDirective& directive, DirectiveError& error);
984  Signal stackCmd_directiveHandler(const FpySequencer_StackCmdDirective& directive, DirectiveError& error);
985  Signal pushTime_directiveHandler(const FpySequencer_PushTimeDirective& directive, DirectiveError& error);
986  Signal setSeed_directiveHandler(const FpySequencer_SetSeedDirective& directive, DirectiveError& error);
987  Signal pushRand_directiveHandler(const FpySequencer_PushRandDirective& directive, DirectiveError& error);
988  Signal getField_directiveHandler(const FpySequencer_GetFieldDirective& directive, DirectiveError& error);
989  Signal peek_directiveHandler(const FpySequencer_PeekDirective& directive, DirectiveError& error);
990  Signal storeRel_directiveHandler(const FpySequencer_StoreRelDirective& directive, DirectiveError& error);
991  Signal call_directiveHandler(const FpySequencer_CallDirective& directive, DirectiveError& error);
992  Signal return_directiveHandler(const FpySequencer_ReturnDirective& directive, DirectiveError& error);
993  Signal loadAbs_directiveHandler(const FpySequencer_LoadAbsDirective& directive, DirectiveError& error);
994  Signal storeAbs_directiveHandler(const FpySequencer_StoreAbsDirective& directive, DirectiveError& error);
995  Signal storeAbsConstOffset_directiveHandler(const FpySequencer_StoreAbsConstOffsetDirective& directive,
996  DirectiveError& error);
997  Signal popEvent_directiveHandler(const FpySequencer_PopEventDirective& directive, DirectiveError& error);
998  Signal popSerializable_directiveHandler(const FpySequencer_PopSerializableDirective& directive,
999  DirectiveError& error);
1000 };
1001 
1002 } // namespace Svc
1003 
1004 #endif
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_allocate.
sets the index of the next directive to execute
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_stackOp.
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_waitAbs.
FpySequencer_StackOpDirective stackOp
void tlmWriteInternal_overflowHook() override
Overflow hook for tlmWriteInternal.
FwIdType FwOpcodeType
The type of a command opcode.
void directive_call_internalInterfaceHandler(const Svc::FpySequencer_CallDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_call.
branches based off of the top byte of the stack
FpySequencer_CallDirective call
PlatformSizeType FwSizeType
FpySequencer_GotoDirective gotoDirective
stores a value to an absolute address in the stack (for global variables), offset from stack ...
I32 FwEnumStoreType
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeRelConstOffset.
FpySequencer_StoreRelDirective storeRel
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
void directive_loadAbs_internalInterfaceHandler(const Svc::FpySequencer_LoadAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_loadAbs.
void directive_storeAbsConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsConstOffsetDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeAbsConstOffset.
U8 bytes[Fpy::MAX_STACK_SIZE]
void pingIn_handler(FwIndexType portNum, U32 key) override
Handler for input port pingIn.
void directive_pushVal_internalInterfaceHandler(const Svc::FpySequencer_PushValDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushVal.
void directive_noOp_internalInterfaceHandler(const Svc::FpySequencer_NoOpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_noOp.
FwIdType FwPrmIdType
The type of a parameter identifier.
FpySequencer_PopSerializableDirective popSerializable
stores a value to a local variable at a compile-time-known offset relative to the current stack frame...
FpySequencer_ConstCmdDirective constCmd
void directive_loadRel_internalInterfaceHandler(const Svc::FpySequencer_LoadRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_loadRel.
Fpy::StackSizeType currentFrameStart
pop an opcode and arg buf off the stack, send to cmd dispatcher and await response ...
FpySequencer_WaitRelDirective waitRel
FpySequencer_WaitAbsDirective waitAbs
FpySequencer_LoadAbsDirective loadAbs
Enum representing a command response.
FpySequencer_PeekDirective peek
FpySequencer_PushValDirective pushVal
FpySequencer_PopEventDirective popEvent
void directive_pushPrm_internalInterfaceHandler(const Svc::FpySequencer_PushPrmDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushPrm.
pops bytes off the top of the stack and does nothing with them
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_goto.
FpySequencer_IfDirective ifDirective
FpySequencer_NoOpDirective noOp
FpySequencer_PushTimeDirective pushTime
FpySequencer_GetFieldDirective getField
FpySequencer_PushTlmValAndTimeDirective pushTlmValAndTime
Fpy::DirectiveErrorCode DirectiveError
FpySequencer_LoadRelDirective loadRel
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.
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.
void directive_setSeed_internalInterfaceHandler(const Svc::FpySequencer_SetSeedDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_setSeed.
pops a severity and message from the stack and emits an F Prime event
void pushZeroes(Fpy::StackSizeType byteCount)
void checkTimersInternal_internalInterfaceHandler() override
Internal interface handler for checkTimersInternal.
FpySequencer_StoreAbsDirective storeAbs
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeRel.
static constexpr FwSizeType MAX_PATH_LENGTH
Maximum supported path length for resolution buffers.
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
Sequencer blocking state.
void directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeAbs.
void directive_stackCmd_internalInterfaceHandler(const Svc::FpySequencer_StackCmdDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_stackCmd.
FpySequencer_PushRandDirective pushRand
void directive_pushRand_internalInterfaceHandler(const Svc::FpySequencer_PushRandDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushRand.
void parameterUpdated(FwPrmIdType id) override
Called whenever a parameter is updated.
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 directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_constCmd.
A generic interface for creating and comparing hash values.
Definition: Hash.hpp:24
void directive_return_internalInterfaceHandler(const Svc::FpySequencer_ReturnDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_return.
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 tlmWriteInternal_internalInterfaceHandler() override
Internal interface handler for tlmWriteInternal.
void directive_getField_internalInterfaceHandler(const Svc::FpySequencer_GetFieldDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_getField.
sleeps for a relative duration from the current time
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTlmValAndTime.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
FpySequencer_PushTlmValDirective pushTlmVal
void directive_pushTlmVal_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTlmVal.
friend class FpySequencerTester
void seqCancelIn_handler(FwIndexType portNum) override
Memory Allocation base class.
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_if.
void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) override
Handler for input port cmdResponseIn.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_exit.
void directive_popSerializable_internalInterfaceHandler(const Svc::FpySequencer_PopSerializableDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_popSerializable.
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
void configureSandbox(const char *directory)
pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
void directive_waitRel_internalInterfaceHandler(const FpySequencer_WaitRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_waitRel.
Fpy::StackSizeType size
pops serialized data from stack and sends to serial output port
void directive_peek_internalInterfaceHandler(const Svc::FpySequencer_PeekDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_peek.
Svc::FpySequencer_SequencerStateMachine_State State
The state type.
stores a value to a local variable at a runtime-determined offset relative to the current stack frame...
RateGroupDivider component implementation.
FpySequencer_SetSeedDirective setSeed
Defines a base class for a memory allocator for classes.
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.
void directive_pushTime_internalInterfaceHandler(const Svc::FpySequencer_PushTimeDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_pushTime.
FpySequencer_ExitDirective exit
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
void directive_popEvent_internalInterfaceHandler(const Svc::FpySequencer_PopEventDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_popEvent.
void directive_memCmp_internalInterfaceHandler(const Svc::FpySequencer_MemCmpDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_memCmp.
Success/Failure.
void directive_discard_internalInterfaceHandler(const Svc::FpySequencer_DiscardDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_discard.
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
FpySequencer(const char *const compName)