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 <random>
13 #include "Fw/Types/StringBase.hpp"
15 #include "Fw/Types/WaitEnumAc.hpp"
16 #include "Os/File.hpp"
26 #include "Utils/Hash/Hash.hpp"
28 
29 static_assert(Svc::Fpy::MAX_SEQUENCE_ARG_COUNT <= std::numeric_limits<U8>::max(),
30  "Sequence arg count must be below U8 max");
31 static_assert(Svc::Fpy::MAX_SEQUENCE_STATEMENT_COUNT <= std::numeric_limits<U16>::max(),
32  "Sequence statement count must be below U16 max");
33 static_assert(Svc::Fpy::MAX_STACK_SIZE <= std::numeric_limits<Svc::Fpy::StackSizeType>::max(),
34  "Max stack size must be below Svc::Fpy::StackSizeType max");
35 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_TLM_BUFFER_MAX_SIZE),
36  "Max stack size must be greater than max tlm buffer size");
37 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_PARAM_BUFFER_MAX_SIZE),
38  "Max stack size must be greater than max prm buffer size");
39 
40 namespace Svc {
41 
45 
47  friend class FpySequencerTester;
48 
49  public:
82 
85  };
86 
87  class Stack {
88  public:
89  // the byte array of the program stack, storing lvars, operands and function calls
91  // how many bytes high the stack is
93  // the byte offset from the start of the stack where the current function's local variables begin.
94  // analogous to a 'frame pointer'.
96 
97  // pops a value off of the top of the stack
98  // converts it from big endian
99  template <typename T>
100  T pop();
101 
102  // pushes a value onto the top of the stack
103  // converts it to big endian
104  template <typename T>
105  void push(T val);
106 
107  // pops a byte array from the top of the stack into the destination array
108  // does not convert endianness
109  void pop(U8* dest, Fpy::StackSizeType size);
110 
111  // pushes a byte array to the top of the stack from the source array
112  // leaves the source array unmodified
113  // does not convert endianness
114  void push(const U8* src, Fpy::StackSizeType size);
115 
116  // pushes zero bytes to the stack
117  void pushZeroes(Fpy::StackSizeType byteCount);
118 
119  // returns a pointer to the next unused byte at the top of the stack
120  U8* top();
121 
122  // Copies data from one region of the stack to another
123  // Asserts that both regions are within bounds and do not overlap
124  // Does not modify stack size
125  void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize);
126 
127  // Moves data within the stack (handles overlapping regions)
128  // Asserts that both source and destination are within bounds
129  // Does not modify stack size
130  void move(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType moveSize);
131  };
132 
133  // ----------------------------------------------------------------------
134  // Construction, initialization, and destruction
135  // ----------------------------------------------------------------------
136 
139  FpySequencer(const char* const compName
140  );
141 
144  ~FpySequencer();
145 
146  private:
150  void RUN_cmdHandler(FwOpcodeType opCode,
151  U32 cmdSeq,
152  const Fw::CmdStringArg& fileName,
153  const Svc::BlockState& block
154  ) override;
155 
157  void RUN_ARGS_cmdHandler(FwOpcodeType opCode,
158  U32 cmdSeq,
159  const Fw::CmdStringArg& fileName,
160  const Svc::BlockState& block,
161  const Svc::SeqArgs& args
162  ) override;
163 
167  void VALIDATE_cmdHandler(FwOpcodeType opCode,
168  U32 cmdSeq,
169  const Fw::CmdStringArg& fileName
170  ) override;
171 
175  void VALIDATE_ARGS_cmdHandler(FwOpcodeType opCode,
176  U32 cmdSeq,
177  const Fw::CmdStringArg& fileName,
178  const Svc::SeqArgs& buffer
179  ) override;
180 
184  void RUN_VALIDATED_cmdHandler(FwOpcodeType opCode,
185  U32 cmdSeq,
186  const Svc::BlockState& block
187  ) override;
188 
192  void CANCEL_cmdHandler(FwOpcodeType opCode,
193  U32 cmdSeq
194  ) override;
195 
202  void SET_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
203  U32 cmdSeq,
204  U32 stmtIdx,
205  bool breakOnce
206  ) override;
207 
213  void BREAK_cmdHandler(FwOpcodeType opCode,
214  U32 cmdSeq
215  ) override;
216 
221  void CONTINUE_cmdHandler(FwOpcodeType opCode,
222  U32 cmdSeq
223  ) override;
224 
229  void CLEAR_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
230  U32 cmdSeq
231  ) override;
232 
238  void STEP_cmdHandler(FwOpcodeType opCode,
239  U32 cmdSeq
240  ) override;
241 
245  void DUMP_STACK_TO_FILE_cmdHandler(FwOpcodeType opCode,
246  U32 cmdSeq,
247  const Fw::CmdStringArg& fileName
248  ) override;
249 
250  // ----------------------------------------------------------------------
251  // Functions to implement for internal state machine actions
252  // ----------------------------------------------------------------------
253 
257  void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
258  SmId smId,
260  ) override;
261 
265  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
266  SmId smId,
269  ) override;
270 
274  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
275  SmId smId,
278  ) override;
279 
283  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
284  SmId smId,
287  ) override;
288 
292  void Svc_FpySequencer_SequencerStateMachine_action_validate(
293  SmId smId,
295  ) override;
296 
300  void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
301  SmId smId,
303  ) override;
304 
308  void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
309  SmId smId,
311  ) override;
312 
316  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
317  SmId smId,
319  ) override;
320 
324  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
325  SmId smId,
327  ) override;
328 
332  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
333  SmId smId,
335  ) override;
336 
340  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
341  SmId smId,
343  ) override;
344 
349  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
350  SmId smId,
352  ) override;
353 
357  void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
358  SmId smId,
360  ) override;
361 
365  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
366  SmId smId,
368  ) override;
369 
373  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
374  SmId smId,
376  ) override;
377 
381  void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
382  SmId smId,
384  ) override;
385 
389  void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
390  SmId smId,
392  ) override;
393 
397  void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
398  SmId smId,
400  ) override;
401 
405  void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
406  SmId smId,
408  ) override;
409 
413  void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
414  SmId smId,
416  ) override;
417 
421  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
422  SmId smId,
424  ) override;
425 
429  void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
430  SmId smId,
432  ) override;
433 
437  void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
438  SmId smId,
441  ) override;
442 
446  void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
447  SmId smId,
449  ) override;
450 
454  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
455  SmId smId,
457  ) override;
458 
462  void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
463  SmId smId,
465  ) override;
466 
470  void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
471  SmId smId,
473  ) override;
474 
475  protected:
476  // ----------------------------------------------------------------------
477  // Functions to implement for internal state machine guards
478  // ----------------------------------------------------------------------
479 
484  SmId smId,
486  ) const override;
487 
493  SmId smId,
495  ) const override;
496 
501  SmId smId,
503  ) const override;
504 
505  // ----------------------------------------------------------------------
506  // Handlers to implement for typed input ports
507  // ----------------------------------------------------------------------
508 
510  void checkTimers_handler(FwIndexType portNum,
511  U32 context
512  ) override;
513 
515  void cmdResponseIn_handler(FwIndexType portNum,
516  FwOpcodeType opCode,
517  U32 cmdSeq,
518  const Fw::CmdResponse& response
519  ) override;
520 
522  void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename, const Svc::SeqArgs& args) override;
523 
527  void seqCancelIn_handler(FwIndexType portNum
528  ) override;
529 
531  void pingIn_handler(FwIndexType portNum,
532  U32 key
533  ) override;
534 
536  void tlmWrite_handler(FwIndexType portNum,
537  U32 context
538  ) override;
539 
542  U64 sequenceIndex) override;
543 
546  U64 sequenceIndex) override;
547 
550  U64 sequenceIndex) override;
551 
554  U64 sequenceIndex) override;
555 
558  U64 sequenceIndex) override;
559 
562  U64 sequenceIndex) override;
563 
567  U64 sequenceIndex) override;
568 
571  U64 sequenceIndex) override;
572 
575  U64 sequenceIndex) override;
576 
579  U64 sequenceIndex) override;
580 
583  U64 sequenceIndex) override;
584 
587  U64 sequenceIndex) override;
588 
592  U64 sequenceIndex) override;
593 
596  U64 sequenceIndex) override;
597 
600  U64 sequenceIndex) override;
601 
604  U64 sequenceIndex) override;
605 
608  U64 sequenceIndex) override;
609 
612  U64 sequenceIndex) override;
613 
616  U64 sequenceIndex) override;
617 
620  U64 sequenceIndex) override;
621 
624  U64 sequenceIndex) override;
625 
628  U64 sequenceIndex) override;
629 
632  U64 sequenceIndex) override;
633 
636  U64 sequenceIndex) override;
637 
640  U64 sequenceIndex) override;
641 
644  U64 sequenceIndex) override;
645 
648  U64 sequenceIndex) override;
649 
652  U64 sequenceIndex) override;
653 
657  U64 sequenceIndex) override;
658 
661  U64 sequenceIndex) override;
662 
665  U64 sequenceIndex) override;
666 
667  void parametersLoaded() override;
668  void parameterUpdated(FwPrmIdType id) override;
669 
670  public:
671  void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator& allocator, FwSizeType bytes);
672 
673  void deallocateBuffer(Fw::MemAllocator& allocator);
674 
675  private:
676  static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
677 
678  // allocated at startup
679  Fw::ExternalSerializeBuffer m_sequenceBuffer;
680  // id of allocator that gave us m_sequenceBuffer
681  FwEnumStoreType m_allocatorId;
682 
683  // assigned by the user via cmd
684  // length is FileNameStringSize
685  Fw::FileNameString m_sequenceFilePath;
686  // the sequence, loaded in memory
687  Fpy::Sequence m_sequenceObj;
688  // live running computation of CRC (updated as we read)
689  Utils::Hash m_computedCRC;
690 
691  // Size of arguments read in current sequence. Used for validation between
692  // User provided arguments and what is requested of the sequence.
693  Fpy::StackSizeType m_totalExpectedArgSize;
694 
695  // whether or not the sequence we're about to run should return immediately or
696  // block on completion
697  Svc::BlockState m_sequenceBlockState;
698  // if we are to block on completion, save the opCode and cmdSeq we should
699  // return
700  FwOpcodeType m_savedOpCode;
701  U32 m_savedCmdSeq;
702 
703  // sequence arguments to push to stack when entering RUNNING state
704  Svc::SeqArgs m_sequenceArgs{};
705 
706  // the goal state is the state that we're trying to reach in the sequencer
707  // if it's RUNNING, then we should promptly go to RUNNING once we validate the
708  // sequence. if it's VALID, we should wait after VALIDATING
709  FpySequencer_GoalState m_goalState;
710 
711  // the total number of sequences this sequencer has started since construction
712  U64 m_sequencesStarted;
713  // the total number of statements this sequencer has dispatched, successfully or
714  // otherwise, since construction
715  U64 m_statementsDispatched;
716 
717  const Fw::String NO_SEQ{"<no seq>"};
718 
719  // the runtime state of the sequence. encapsulates all state
720  // needed to run the sequence.
721  // this is distinct from the state of the sequencer. the
722  // sequencer and all its state is really just a shell to load
723  // and execute this runtime.
724  struct Runtime {
725  // the index of the next statement to be executed
726  U32 nextStatementIndex = 0;
727 
728  // the opcode of the statement that is currently executing
729  U8 currentStatementOpcode = Fpy::DirectiveId::INVALID;
730  // the opcode of the command that we are currently awaiting, or 0 if we are executing a directive
731  FwOpcodeType currentCmdOpcode = 0;
732  // the time we dispatched the statement that is currently executing
733  Fw::Time currentStatementDispatchTime = Fw::Time();
734 
735  // the absolute time we should wait for until returning
736  // a statement response
737  Fw::Time wakeupTime = Fw::Time();
738 
739  // RNG state used by PUSH_RAND and SET_SEED directives during this run
740  std::mt19937 rng;
741  bool rngSeeded = false;
742 
743  Stack stack = Stack();
744  } m_runtime;
745 
746  // the state of the debugger. debugger is separate from runtime
747  // because it can be set up before running the sequence.
748  struct BreakpointInfo {
749  // whether or not to break at the debug breakpoint index
750  bool breakpointInUse = false;
751  // whether or not to remove the breakpoint after breaking on it
752  bool breakOnlyOnceOnBreakpoint = false;
753  // the statement index at which to break, before dispatching
754  U32 breakpointIndex = 0;
755  // whether or not to break before dispatching the next line,
756  // independent of what line it is.
757  // can be used in combination with breakpointIndex
758  bool breakBeforeNextLine = false;
759  } m_breakpoint;
760 
761  // debug information about the sequence. only valid in the PAUSED state
762  // which you can access via BREAK or SET_BREAKPOINT cmds
763  struct DebugInfo {
764  // true if there are no statements remaining in the sequence file
765  bool reachedEndOfFile = false;
766  // true if we were able to deserialize the next statement successfully
767  bool nextStatementReadSuccess = false;
768  // the opcode of the next statement to dispatch.
769  U8 nextStatementOpcode = 0;
770  // if the next statement is a cmd directive, the opcode of that cmd
771  FwOpcodeType nextCmdOpcode = 0;
772  // the index of the next statement we're going to execute
773  U32 nextStatementIndex = 0;
774  // the size of the stack. store this separately from the real stack size
775  // so we can avoid changing this during runtime, only modify it during
776  // debug
777  Fpy::StackSizeType stackSize = 0;
778  } m_debug;
779 
780  struct Telemetry {
781  // the number of statements that failed to execute
782  U64 statementsFailed = 0;
783  // the number of sequences successfully completed
784  U64 sequencesSucceeded = 0;
785  // the number of sequences that failed to validate or execute
786  U64 sequencesFailed = 0;
787  // the number of sequences that have been cancelled
788  U64 sequencesCancelled = 0;
789 
790  // the error code of the last directive that ran
791  DirectiveError lastDirectiveError = DirectiveError::NO_ERROR;
792  // the index of the last directive that errored
793  U64 directiveErrorIndex = 0;
794  // the opcode of the last directive that errored
795  Fpy::DirectiveId directiveErrorId = Fpy::DirectiveId::INVALID;
796  } m_tlm;
797 
798  // ----------------------------------------------------------------------
799  // Validation state
800  // ----------------------------------------------------------------------
801 
802  // loads the sequence in memory, and does header/crc/integrity checks.
803  // return SUCCESS if sequence is valid, FAILURE otherwise
804  Fw::Success validate();
805  // reads and validates the header from the m_sequenceBuffer
806  // return SUCCESS if sequence is valid, FAILURE otherwise
807  Fw::Success readHeader();
808  // reads and validates the body from the m_sequenceBuffer
809  // return SUCCESS if sequence is valid, FAILURE otherwise
810  Fw::Success readBody();
811  // reads and validates the footer from the m_sequenceBuffer
812  // return SUCCESS if sequence is valid, FAILURE otherwise
813  Fw::Success readFooter();
814 
815  // reads some bytes from the open file into the m_sequenceBuffer.
816  // updates the CRC by default, but can be turned off if the contents
817  // aren't included in CRC.
818  // return success if successful
819  Fw::Success readBytes(Os::File& file,
820  FwSizeType readLen,
821  const FpySequencer_FileReadStage& readStage,
822  bool updateCrc = true);
823 
824  // ----------------------------------------------------------------------
825  // Run state
826  // ----------------------------------------------------------------------
827 
828  // utility method for updating telemetry based on a directive error code
829  void handleDirectiveErrorCode(Fpy::DirectiveId id, DirectiveError err);
830 
831  // dispatches the next statement
832  Signal dispatchStatement();
833 
834  // deserializes a directive from bytes into the Fpy type
835  // returns success if able to deserialize, and returns the Fpy type object
836  // as a reference, in a union of all the possible directive type objects
837  Fw::Success deserializeDirective(const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
838 
839  // dispatches a deserialized sequencer directive to the right handler.
840  void dispatchDirective(const DirectiveUnion& directive, const Fpy::DirectiveId& id);
841 
842  // checks whether the currently executing statement timed out
843  Signal checkStatementTimeout();
844 
845  // checks whether the sequencer should wake from sleeping
846  Signal checkShouldWake();
847 
848  // return true if state is a substate of RUNNING
849  bool isRunningState(State state);
850 
851  // return true if a directive dispatched by the given sequence can execute in the current state.
852  // otherwise, log a warning
853  bool checkDirectiveExpected(Fpy::DirectiveId directive, U64 sequenceIndex);
854 
855  // update a struct containing debug telemetry, or defaults if not in debug break
856  void updateDebugTelemetryStruct();
857 
858  // ----------------------------------------------------------------------
859  // Directives
860  // ----------------------------------------------------------------------
861 
862  // sends a signal based on a signal id
863  void sendSignal(Signal signal);
864 
865  // dispatches a command, returns whether successful or not
866  Fw::Success sendCmd(FwOpcodeType opcode, const U8* argBuf, FwSizeType argBufSize);
867 
868  // returns the index of the current statement
869  U32 currentStatementIdx();
870 
871  // we split these functions up into the internalInterfaceInvoke and these custom member funcs
872  // so that we can unit test them easier
873  Signal waitRel_directiveHandler(const FpySequencer_WaitRelDirective& directive, DirectiveError& error);
874  Signal waitAbs_directiveHandler(const FpySequencer_WaitAbsDirective& directive, DirectiveError& error);
875  Signal goto_directiveHandler(const FpySequencer_GotoDirective& directive, DirectiveError& error);
876  Signal if_directiveHandler(const FpySequencer_IfDirective& directive, DirectiveError& error);
877  Signal noOp_directiveHandler(const FpySequencer_NoOpDirective& directive, DirectiveError& error);
878  Signal pushTlmVal_directiveHandler(const FpySequencer_PushTlmValDirective& directive, DirectiveError& error);
879  Signal pushTlmValAndTime_directiveHandler(const FpySequencer_PushTlmValAndTimeDirective& directive,
880  DirectiveError& error);
881  Signal pushPrm_directiveHandler(const FpySequencer_PushPrmDirective& directive, DirectiveError& error);
882  Signal constCmd_directiveHandler(const FpySequencer_ConstCmdDirective& directive, DirectiveError& error);
883  Signal stackOp_directiveHandler(const FpySequencer_StackOpDirective& directive, DirectiveError& error);
884 
885  DirectiveError op_or();
886  DirectiveError op_and();
887  DirectiveError op_ieq();
888  DirectiveError op_ine();
889  DirectiveError op_ult();
890  DirectiveError op_ule();
891  DirectiveError op_ugt();
892  DirectiveError op_uge();
893  DirectiveError op_slt();
894  DirectiveError op_sle();
895  DirectiveError op_sgt();
896  DirectiveError op_sge();
897  DirectiveError op_feq();
898  DirectiveError op_fne();
899  DirectiveError op_flt();
900  DirectiveError op_fle();
901  DirectiveError op_fgt();
902  DirectiveError op_fge();
903  DirectiveError op_not();
904  DirectiveError op_fpext();
905  DirectiveError op_fptrunc();
906  DirectiveError op_fptoui();
907  DirectiveError op_fptosi();
908  DirectiveError op_sitofp();
909  DirectiveError op_uitofp();
910  DirectiveError op_add();
911  DirectiveError op_sub();
912  DirectiveError op_mul();
913  DirectiveError op_udiv();
914  DirectiveError op_sdiv();
915  DirectiveError op_umod();
916  DirectiveError op_smod();
917  DirectiveError op_fadd();
918  DirectiveError op_fsub();
919  DirectiveError op_fmul();
920  DirectiveError op_fdiv();
921  DirectiveError op_fpow();
922  DirectiveError op_flog();
923  DirectiveError op_fmod();
924  DirectiveError op_siext_8_64();
925  DirectiveError op_siext_16_64();
926  DirectiveError op_siext_32_64();
927  DirectiveError op_ziext_8_64();
928  DirectiveError op_ziext_16_64();
929  DirectiveError op_ziext_32_64();
930  DirectiveError op_itrunc_64_8();
931  DirectiveError op_itrunc_64_16();
932  DirectiveError op_itrunc_64_32();
933  DirectiveError op_ffloor();
934  DirectiveError op_iabs();
935  DirectiveError op_fabs();
936 
937  Signal exit_directiveHandler(const FpySequencer_ExitDirective& directive, DirectiveError& error);
938  Signal allocate_directiveHandler(const FpySequencer_AllocateDirective& directive, DirectiveError& error);
940  Signal storeHelper(Fpy::StackSizeType destOffset, Fpy::StackSizeType size, DirectiveError& error);
942  Signal loadHelper(Fpy::StackSizeType srcOffset, Fpy::StackSizeType size, DirectiveError& error);
943  Signal storeRelConstOffset_directiveHandler(const FpySequencer_StoreRelConstOffsetDirective& directive,
944  DirectiveError& error);
945  Signal loadRel_directiveHandler(const FpySequencer_LoadRelDirective& directive, DirectiveError& error);
946  Signal pushVal_directiveHandler(const FpySequencer_PushValDirective& directive, DirectiveError& error);
947  Signal discard_directiveHandler(const FpySequencer_DiscardDirective& directive, DirectiveError& error);
948  Signal memCmp_directiveHandler(const FpySequencer_MemCmpDirective& directive, DirectiveError& error);
949  Signal stackCmd_directiveHandler(const FpySequencer_StackCmdDirective& directive, DirectiveError& error);
950  Signal pushTime_directiveHandler(const FpySequencer_PushTimeDirective& directive, DirectiveError& error);
951  Signal setSeed_directiveHandler(const FpySequencer_SetSeedDirective& directive, DirectiveError& error);
952  Signal pushRand_directiveHandler(const FpySequencer_PushRandDirective& directive, DirectiveError& error);
953  Signal getField_directiveHandler(const FpySequencer_GetFieldDirective& directive, DirectiveError& error);
954  Signal peek_directiveHandler(const FpySequencer_PeekDirective& directive, DirectiveError& error);
955  Signal storeRel_directiveHandler(const FpySequencer_StoreRelDirective& directive, DirectiveError& error);
956  Signal call_directiveHandler(const FpySequencer_CallDirective& directive, DirectiveError& error);
957  Signal return_directiveHandler(const FpySequencer_ReturnDirective& directive, DirectiveError& error);
958  Signal loadAbs_directiveHandler(const FpySequencer_LoadAbsDirective& directive, DirectiveError& error);
959  Signal storeAbs_directiveHandler(const FpySequencer_StoreAbsDirective& directive, DirectiveError& error);
960  Signal storeAbsConstOffset_directiveHandler(const FpySequencer_StoreAbsConstOffsetDirective& directive,
961  DirectiveError& error);
962  Signal popEvent_directiveHandler(const FpySequencer_PopEventDirective& directive, DirectiveError& error);
963  Signal popSerializable_directiveHandler(const FpySequencer_PopSerializableDirective& directive,
964  DirectiveError& error);
965 };
966 
967 } // namespace Svc
968 
969 #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
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)
FpySequencer_StoreAbsDirective storeAbs
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive, U64 sequenceIndex) override
Internal interface handler for directive_storeRel.
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 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
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)