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:
81 
84  };
85 
86  class Stack {
87  public:
88  // the byte array of the program stack, storing lvars, operands and function calls
90  // how many bytes high the stack is
92  // the byte offset from the start of the stack where the current function's local variables begin.
93  // analogous to a 'frame pointer'.
95 
96  // pops a value off of the top of the stack
97  // converts it from big endian
98  template <typename T>
99  T pop();
100 
101  // pushes a value onto the top of the stack
102  // converts it to big endian
103  template <typename T>
104  void push(T val);
105 
106  // pops a byte array from the top of the stack into the destination array
107  // does not convert endianness
108  void pop(U8* dest, Fpy::StackSizeType size);
109 
110  // pushes a byte array to the top of the stack from the source array
111  // leaves the source array unmodified
112  // does not convert endianness
113  void push(const U8* src, Fpy::StackSizeType size);
114 
115  // pushes zero bytes to the stack
116  void pushZeroes(Fpy::StackSizeType byteCount);
117 
118  // returns a pointer to the next unused byte at the top of the stack
119  U8* top();
120 
121  // Copies data from one region of the stack to another
122  // Asserts that both regions are within bounds and do not overlap
123  // Does not modify stack size
124  void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize);
125 
126  // Moves data within the stack (handles overlapping regions)
127  // Asserts that both source and destination are within bounds
128  // Does not modify stack size
129  void move(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType moveSize);
130  };
131 
132  // ----------------------------------------------------------------------
133  // Construction, initialization, and destruction
134  // ----------------------------------------------------------------------
135 
138  FpySequencer(const char* const compName
139  );
140 
143  ~FpySequencer();
144 
145  private:
149  void RUN_cmdHandler(FwOpcodeType opCode,
150  U32 cmdSeq,
151  const Fw::CmdStringArg& fileName,
152  Svc::BlockState block
153  ) override;
154 
156  void RUN_ARGS_cmdHandler(FwOpcodeType opCode,
157  U32 cmdSeq,
158  const Fw::CmdStringArg& fileName,
159  Svc::BlockState block,
160  Svc::SeqArgs args
161  ) override;
162 
166  void VALIDATE_cmdHandler(FwOpcodeType opCode,
167  U32 cmdSeq,
168  const Fw::CmdStringArg& fileName
169  ) override;
170 
174  void VALIDATE_ARGS_cmdHandler(FwOpcodeType opCode,
175  U32 cmdSeq,
176  const Fw::CmdStringArg& fileName,
177  Svc::SeqArgs buffer
178  ) override;
179 
183  void RUN_VALIDATED_cmdHandler(FwOpcodeType opCode,
184  U32 cmdSeq,
185  Svc::BlockState block
186  ) override;
187 
191  void CANCEL_cmdHandler(FwOpcodeType opCode,
192  U32 cmdSeq
193  ) override;
194 
201  void SET_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
202  U32 cmdSeq,
203  U32 stmtIdx,
204  bool breakOnce
205  ) override;
206 
212  void BREAK_cmdHandler(FwOpcodeType opCode,
213  U32 cmdSeq
214  ) override;
215 
220  void CONTINUE_cmdHandler(FwOpcodeType opCode,
221  U32 cmdSeq
222  ) override;
223 
228  void CLEAR_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
229  U32 cmdSeq
230  ) override;
231 
237  void STEP_cmdHandler(FwOpcodeType opCode,
238  U32 cmdSeq
239  ) override;
240 
244  void DUMP_STACK_TO_FILE_cmdHandler(FwOpcodeType opCode,
245  U32 cmdSeq,
246  const Fw::CmdStringArg& fileName
247  ) override;
248 
249  // ----------------------------------------------------------------------
250  // Functions to implement for internal state machine actions
251  // ----------------------------------------------------------------------
252 
256  void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
257  SmId smId,
259  ) override;
260 
264  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
265  SmId smId,
268  ) override;
269 
273  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
274  SmId smId,
277  ) override;
278 
282  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
283  SmId smId,
286  ) override;
287 
291  void Svc_FpySequencer_SequencerStateMachine_action_validate(
292  SmId smId,
294  ) override;
295 
299  void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
300  SmId smId,
302  ) override;
303 
307  void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
308  SmId smId,
310  ) override;
311 
315  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
316  SmId smId,
318  ) override;
319 
323  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
324  SmId smId,
326  ) override;
327 
331  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
332  SmId smId,
334  ) override;
335 
339  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
340  SmId smId,
342  ) override;
343 
348  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
349  SmId smId,
351  ) override;
352 
356  void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
357  SmId smId,
359  ) override;
360 
364  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
365  SmId smId,
367  ) override;
368 
372  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
373  SmId smId,
375  ) override;
376 
380  void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
381  SmId smId,
383  ) override;
384 
388  void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
389  SmId smId,
391  ) override;
392 
396  void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
397  SmId smId,
399  ) override;
400 
404  void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
405  SmId smId,
407  ) override;
408 
412  void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
413  SmId smId,
415  ) override;
416 
420  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
421  SmId smId,
423  ) override;
424 
428  void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
429  SmId smId,
431  ) override;
432 
436  void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
437  SmId smId,
440  ) override;
441 
445  void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
446  SmId smId,
448  ) override;
449 
453  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
454  SmId smId,
456  ) override;
457 
461  void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
462  SmId smId,
464  ) override;
465 
469  void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
470  SmId smId,
472  ) override;
473 
474  protected:
475  // ----------------------------------------------------------------------
476  // Functions to implement for internal state machine guards
477  // ----------------------------------------------------------------------
478 
483  SmId smId,
485  ) const override;
486 
492  SmId smId,
494  ) const override;
495 
500  SmId smId,
502  ) const override;
503 
504  // ----------------------------------------------------------------------
505  // Handlers to implement for typed input ports
506  // ----------------------------------------------------------------------
507 
509  void checkTimers_handler(FwIndexType portNum,
510  U32 context
511  ) override;
512 
514  void cmdResponseIn_handler(FwIndexType portNum,
515  FwOpcodeType opCode,
516  U32 cmdSeq,
517  const Fw::CmdResponse& response
518  ) override;
519 
521  void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename, const Svc::SeqArgs& args) override;
522 
526  void seqCancelIn_handler(FwIndexType portNum
527  ) override;
528 
530  void pingIn_handler(FwIndexType portNum,
531  U32 key
532  ) override;
533 
535  void tlmWrite_handler(FwIndexType portNum,
536  U32 context
537  ) override;
538 
541 
544 
547 
550 
553 
556 
559  const Svc::FpySequencer_PushTlmValAndTimeDirective& directive) override;
560 
563 
566 
569 
572 
575 
578  const Svc::FpySequencer_StoreRelConstOffsetDirective& directive) override;
579 
582 
585 
588 
591 
594 
597 
600 
603 
606 
609 
612 
615 
618 
621 
624 
627  const Svc::FpySequencer_StoreAbsConstOffsetDirective& directive) override;
628 
631 
632  void parametersLoaded() override;
633  void parameterUpdated(FwPrmIdType id) override;
634 
635  public:
636  void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator& allocator, FwSizeType bytes);
637 
638  void deallocateBuffer(Fw::MemAllocator& allocator);
639 
640  private:
641  static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
642 
643  // allocated at startup
644  Fw::ExternalSerializeBuffer m_sequenceBuffer;
645  // id of allocator that gave us m_sequenceBuffer
646  FwEnumStoreType m_allocatorId;
647 
648  // assigned by the user via cmd
649  // length is FileNameStringSize
650  Fw::FileNameString m_sequenceFilePath;
651  // the sequence, loaded in memory
652  Fpy::Sequence m_sequenceObj;
653  // live running computation of CRC (updated as we read)
654  Utils::Hash m_computedCRC;
655 
656  // Size of arguments read in current sequence. Used for validation between
657  // User provided arguments and what is requested of the sequence.
658  Fpy::StackSizeType m_totalExpectedArgSize;
659 
660  // whether or not the sequence we're about to run should return immediately or
661  // block on completion
662  Svc::BlockState m_sequenceBlockState;
663  // if we are to block on completion, save the opCode and cmdSeq we should
664  // return
665  FwOpcodeType m_savedOpCode;
666  U32 m_savedCmdSeq;
667 
668  // sequence arguments to push to stack when entering RUNNING state
669  Svc::SeqArgs m_sequenceArgs{};
670 
671  // the goal state is the state that we're trying to reach in the sequencer
672  // if it's RUNNING, then we should promptly go to RUNNING once we validate the
673  // sequence. if it's VALID, we should wait after VALIDATING
674  FpySequencer_GoalState m_goalState;
675 
676  // the total number of sequences this sequencer has started since construction
677  U64 m_sequencesStarted;
678  // the total number of statements this sequencer has dispatched, successfully or
679  // otherwise, since construction
680  U64 m_statementsDispatched;
681 
682  // the runtime state of the sequence. encapsulates all state
683  // needed to run the sequence.
684  // this is distinct from the state of the sequencer. the
685  // sequencer and all its state is really just a shell to load
686  // and execute this runtime.
687  struct Runtime {
688  // the index of the next statement to be executed
689  U32 nextStatementIndex = 0;
690 
691  // the opcode of the statement that is currently executing
692  U8 currentStatementOpcode = Fpy::DirectiveId::INVALID;
693  // the opcode of the command that we are currently awaiting, or 0 if we are executing a directive
694  FwOpcodeType currentCmdOpcode = 0;
695  // the time we dispatched the statement that is currently executing
696  Fw::Time currentStatementDispatchTime = Fw::Time();
697 
698  // the absolute time we should wait for until returning
699  // a statement response
700  Fw::Time wakeupTime = Fw::Time();
701 
702  // RNG state used by PUSH_RAND and SET_SEED directives during this run
703  std::mt19937 rng;
704  bool rngSeeded = false;
705 
706  Stack stack = Stack();
707  } m_runtime;
708 
709  // the state of the debugger. debugger is separate from runtime
710  // because it can be set up before running the sequence.
711  struct BreakpointInfo {
712  // whether or not to break at the debug breakpoint index
713  bool breakpointInUse = false;
714  // whether or not to remove the breakpoint after breaking on it
715  bool breakOnlyOnceOnBreakpoint = false;
716  // the statement index at which to break, before dispatching
717  U32 breakpointIndex = 0;
718  // whether or not to break before dispatching the next line,
719  // independent of what line it is.
720  // can be used in combination with breakpointIndex
721  bool breakBeforeNextLine = false;
722  } m_breakpoint;
723 
724  // debug information about the sequence. only valid in the PAUSED state
725  // which you can access via BREAK or SET_BREAKPOINT cmds
726  struct DebugInfo {
727  // true if there are no statements remaining in the sequence file
728  bool reachedEndOfFile = false;
729  // true if we were able to deserialize the next statement successfully
730  bool nextStatementReadSuccess = false;
731  // the opcode of the next statement to dispatch.
732  U8 nextStatementOpcode = 0;
733  // if the next statement is a cmd directive, the opcode of that cmd
734  FwOpcodeType nextCmdOpcode = 0;
735  // the index of the next statement we're going to execute
736  U32 nextStatementIndex = 0;
737  // the size of the stack. store this separately from the real stack size
738  // so we can avoid changing this during runtime, only modify it during
739  // debug
740  Fpy::StackSizeType stackSize = 0;
741  } m_debug;
742 
743  struct Telemetry {
744  // the number of statements that failed to execute
745  U64 statementsFailed = 0;
746  // the number of sequences successfully completed
747  U64 sequencesSucceeded = 0;
748  // the number of sequences that failed to validate or execute
749  U64 sequencesFailed = 0;
750  // the number of sequences that have been cancelled
751  U64 sequencesCancelled = 0;
752 
753  // the error code of the last directive that ran
754  DirectiveError lastDirectiveError = DirectiveError::NO_ERROR;
755  // the index of the last directive that errored
756  U64 directiveErrorIndex = 0;
757  // the opcode of the last directive that errored
758  Fpy::DirectiveId directiveErrorId = Fpy::DirectiveId::INVALID;
759  } m_tlm;
760 
761  // ----------------------------------------------------------------------
762  // Validation state
763  // ----------------------------------------------------------------------
764 
765  // loads the sequence in memory, and does header/crc/integrity checks.
766  // return SUCCESS if sequence is valid, FAILURE otherwise
767  Fw::Success validate();
768  // reads and validates the header from the m_sequenceBuffer
769  // return SUCCESS if sequence is valid, FAILURE otherwise
770  Fw::Success readHeader();
771  // reads and validates the body from the m_sequenceBuffer
772  // return SUCCESS if sequence is valid, FAILURE otherwise
773  Fw::Success readBody();
774  // reads and validates the footer from the m_sequenceBuffer
775  // return SUCCESS if sequence is valid, FAILURE otherwise
776  Fw::Success readFooter();
777 
778  // reads some bytes from the open file into the m_sequenceBuffer.
779  // updates the CRC by default, but can be turned off if the contents
780  // aren't included in CRC.
781  // return success if successful
782  Fw::Success readBytes(Os::File& file,
783  FwSizeType readLen,
784  const FpySequencer_FileReadStage& readStage,
785  bool updateCrc = true);
786 
787  // ----------------------------------------------------------------------
788  // Run state
789  // ----------------------------------------------------------------------
790 
791  // utility method for updating telemetry based on a directive error code
792  void handleDirectiveErrorCode(Fpy::DirectiveId id, DirectiveError err);
793 
794  // dispatches the next statement
795  Signal dispatchStatement();
796 
797  // deserializes a directive from bytes into the Fpy type
798  // returns success if able to deserialize, and returns the Fpy type object
799  // as a reference, in a union of all the possible directive type objects
800  Fw::Success deserializeDirective(const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
801 
802  // dispatches a deserialized sequencer directive to the right handler.
803  void dispatchDirective(const DirectiveUnion& directive, const Fpy::DirectiveId& id);
804 
805  // checks whether the currently executing statement timed out
806  Signal checkStatementTimeout();
807 
808  // checks whether the sequencer should wake from sleeping
809  Signal checkShouldWake();
810 
811  // return true if state is a substate of RUNNING
812  bool isRunningState(State state);
813 
814  // update a struct containing debug telemetry, or defaults if not in debug break
815  void updateDebugTelemetryStruct();
816 
817  // ----------------------------------------------------------------------
818  // Directives
819  // ----------------------------------------------------------------------
820 
821  // sends a signal based on a signal id
822  void sendSignal(Signal signal);
823 
824  // dispatches a command, returns whether successful or not
825  Fw::Success sendCmd(FwOpcodeType opcode, const U8* argBuf, FwSizeType argBufSize);
826 
827  // returns the index of the current statement
828  U32 currentStatementIdx();
829 
830  // we split these functions up into the internalInterfaceInvoke and these custom member funcs
831  // so that we can unit test them easier
832  Signal waitRel_directiveHandler(const FpySequencer_WaitRelDirective& directive, DirectiveError& error);
833  Signal waitAbs_directiveHandler(const FpySequencer_WaitAbsDirective& directive, DirectiveError& error);
834  Signal goto_directiveHandler(const FpySequencer_GotoDirective& directive, DirectiveError& error);
835  Signal if_directiveHandler(const FpySequencer_IfDirective& directive, DirectiveError& error);
836  Signal noOp_directiveHandler(const FpySequencer_NoOpDirective& directive, DirectiveError& error);
837  Signal pushTlmVal_directiveHandler(const FpySequencer_PushTlmValDirective& directive, DirectiveError& error);
838  Signal pushTlmValAndTime_directiveHandler(const FpySequencer_PushTlmValAndTimeDirective& directive,
839  DirectiveError& error);
840  Signal pushPrm_directiveHandler(const FpySequencer_PushPrmDirective& directive, DirectiveError& error);
841  Signal constCmd_directiveHandler(const FpySequencer_ConstCmdDirective& directive, DirectiveError& error);
842  Signal stackOp_directiveHandler(const FpySequencer_StackOpDirective& directive, DirectiveError& error);
843 
844  DirectiveError op_or();
845  DirectiveError op_and();
846  DirectiveError op_ieq();
847  DirectiveError op_ine();
848  DirectiveError op_ult();
849  DirectiveError op_ule();
850  DirectiveError op_ugt();
851  DirectiveError op_uge();
852  DirectiveError op_slt();
853  DirectiveError op_sle();
854  DirectiveError op_sgt();
855  DirectiveError op_sge();
856  DirectiveError op_feq();
857  DirectiveError op_fne();
858  DirectiveError op_flt();
859  DirectiveError op_fle();
860  DirectiveError op_fgt();
861  DirectiveError op_fge();
862  DirectiveError op_not();
863  DirectiveError op_fpext();
864  DirectiveError op_fptrunc();
865  DirectiveError op_fptoui();
866  DirectiveError op_fptosi();
867  DirectiveError op_sitofp();
868  DirectiveError op_uitofp();
869  DirectiveError op_add();
870  DirectiveError op_sub();
871  DirectiveError op_mul();
872  DirectiveError op_udiv();
873  DirectiveError op_sdiv();
874  DirectiveError op_umod();
875  DirectiveError op_smod();
876  DirectiveError op_fadd();
877  DirectiveError op_fsub();
878  DirectiveError op_fmul();
879  DirectiveError op_fdiv();
880  DirectiveError op_float_floor_div();
881  DirectiveError op_fpow();
882  DirectiveError op_flog();
883  DirectiveError op_fmod();
884  DirectiveError op_siext_8_64();
885  DirectiveError op_siext_16_64();
886  DirectiveError op_siext_32_64();
887  DirectiveError op_ziext_8_64();
888  DirectiveError op_ziext_16_64();
889  DirectiveError op_ziext_32_64();
890  DirectiveError op_itrunc_64_8();
891  DirectiveError op_itrunc_64_16();
892  DirectiveError op_itrunc_64_32();
893 
894  Signal exit_directiveHandler(const FpySequencer_ExitDirective& directive, DirectiveError& error);
895  Signal allocate_directiveHandler(const FpySequencer_AllocateDirective& directive, DirectiveError& error);
897  Signal storeHelper(Fpy::StackSizeType destOffset, Fpy::StackSizeType size, DirectiveError& error);
899  Signal loadHelper(Fpy::StackSizeType srcOffset, Fpy::StackSizeType size, DirectiveError& error);
900  Signal storeRelConstOffset_directiveHandler(const FpySequencer_StoreRelConstOffsetDirective& directive,
901  DirectiveError& error);
902  Signal loadRel_directiveHandler(const FpySequencer_LoadRelDirective& directive, DirectiveError& error);
903  Signal pushVal_directiveHandler(const FpySequencer_PushValDirective& directive, DirectiveError& error);
904  Signal discard_directiveHandler(const FpySequencer_DiscardDirective& directive, DirectiveError& error);
905  Signal memCmp_directiveHandler(const FpySequencer_MemCmpDirective& directive, DirectiveError& error);
906  Signal stackCmd_directiveHandler(const FpySequencer_StackCmdDirective& directive, DirectiveError& error);
907  Signal pushTime_directiveHandler(const FpySequencer_PushTimeDirective& directive, DirectiveError& error);
908  Signal setSeed_directiveHandler(const FpySequencer_SetSeedDirective& directive, DirectiveError& error);
909  Signal pushRand_directiveHandler(const FpySequencer_PushRandDirective& directive, DirectiveError& error);
910  Signal getField_directiveHandler(const FpySequencer_GetFieldDirective& directive, DirectiveError& error);
911  Signal peek_directiveHandler(const FpySequencer_PeekDirective& directive, DirectiveError& error);
912  Signal storeRel_directiveHandler(const FpySequencer_StoreRelDirective& directive, DirectiveError& error);
913  Signal call_directiveHandler(const FpySequencer_CallDirective& directive, DirectiveError& error);
914  Signal return_directiveHandler(const FpySequencer_ReturnDirective& directive, DirectiveError& error);
915  Signal loadAbs_directiveHandler(const FpySequencer_LoadAbsDirective& directive, DirectiveError& error);
916  Signal storeAbs_directiveHandler(const FpySequencer_StoreAbsDirective& directive, DirectiveError& error);
917  Signal storeAbsConstOffset_directiveHandler(const FpySequencer_StoreAbsConstOffsetDirective& directive,
918  DirectiveError& error);
919  Signal popEvent_directiveHandler(const FpySequencer_PopEventDirective& directive, DirectiveError& error);
920 };
921 
922 } // namespace Svc
923 
924 #endif
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive) override
Internal interface handler for directive_storeRelConstOffset.
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive) override
Internal interface handler for directive_storeRel.
void directive_return_internalInterfaceHandler(const Svc::FpySequencer_ReturnDirective &directive) override
Internal interface handler for directive_return.
sets the index of the next directive to execute
void directive_call_internalInterfaceHandler(const Svc::FpySequencer_CallDirective &directive) override
Internal interface handler for directive_call.
FpySequencer_StackOpDirective stackOp
FwIdType FwOpcodeType
The type of a command opcode.
branches based off of the top byte of the stack
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive) override
Internal interface handler for directive_if.
FpySequencer_CallDirective call
void directive_setSeed_internalInterfaceHandler(const Svc::FpySequencer_SetSeedDirective &directive) override
Internal interface handler for directive_setSeed.
PlatformSizeType FwSizeType
FpySequencer_GotoDirective gotoDirective
stores a value to an absolute address in the stack (for global variables), offset from stack ...
void directive_loadAbs_internalInterfaceHandler(const Svc::FpySequencer_LoadAbsDirective &directive) override
Internal interface handler for directive_loadAbs.
I32 FwEnumStoreType
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive) override
Internal interface handler for directive_stackOp.
FpySequencer_StoreRelDirective storeRel
bool Svc_FpySequencer_SequencerStateMachine_guard_goalStateIs_RUNNING(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
void directive_getField_internalInterfaceHandler(const Svc::FpySequencer_GetFieldDirective &directive) override
Internal interface handler for directive_getField.
U8 bytes[Fpy::MAX_STACK_SIZE]
void pingIn_handler(FwIndexType portNum, U32 key) override
Handler for input port pingIn.
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive) override
Internal interface handler for directive_pushTlmValAndTime.
FwIdType FwPrmIdType
The type of a parameter identifier.
stores a value to a local variable at a compile-time-known offset relative to the current stack frame...
void directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive) override
Internal interface handler for directive_constCmd.
FpySequencer_ConstCmdDirective constCmd
Fpy::StackSizeType currentFrameStart
pop an opcode and arg buf off the stack, send to cmd dispatcher and await response ...
void directive_peek_internalInterfaceHandler(const Svc::FpySequencer_PeekDirective &directive) override
Internal interface handler for directive_peek.
FpySequencer_WaitRelDirective waitRel
FpySequencer_WaitAbsDirective waitAbs
void directive_loadRel_internalInterfaceHandler(const Svc::FpySequencer_LoadRelDirective &directive) override
Internal interface handler for directive_loadRel.
void directive_memCmp_internalInterfaceHandler(const Svc::FpySequencer_MemCmpDirective &directive) override
Internal interface handler for directive_memCmp.
void directive_pushVal_internalInterfaceHandler(const Svc::FpySequencer_PushValDirective &directive) override
Internal interface handler for directive_pushVal.
FpySequencer_LoadAbsDirective loadAbs
Enum representing a command response.
FpySequencer_PeekDirective peek
void directive_pushPrm_internalInterfaceHandler(const Svc::FpySequencer_PushPrmDirective &directive) override
Internal interface handler for directive_pushPrm.
FpySequencer_PushValDirective pushVal
FpySequencer_PopEventDirective popEvent
pops bytes off the top of the stack and does nothing with them
void directive_pushTime_internalInterfaceHandler(const Svc::FpySequencer_PushTimeDirective &directive) override
Internal interface handler for directive_pushTime.
FpySequencer_IfDirective ifDirective
FpySequencer_NoOpDirective noOp
FpySequencer_PushTimeDirective pushTime
void directive_pushRand_internalInterfaceHandler(const Svc::FpySequencer_PushRandDirective &directive) override
Internal interface handler for directive_pushRand.
FpySequencer_GetFieldDirective getField
FpySequencer_PushTlmValAndTimeDirective pushTlmValAndTime
Fpy::DirectiveErrorCode DirectiveError
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive) override
Internal interface handler for directive_allocate.
FpySequencer_LoadRelDirective loadRel
void directive_waitRel_internalInterfaceHandler(const FpySequencer_WaitRelDirective &directive) override
Internal interface handler for directive_waitRel.
void directive_noOp_internalInterfaceHandler(const Svc::FpySequencer_NoOpDirective &directive) override
Internal interface handler for directive_noOp.
loads a value from a local variable at a compile-time-known offset relative to the current stack fram...
void parametersLoaded() override
Called whenever parameters are loaded.
void directive_stackCmd_internalInterfaceHandler(const Svc::FpySequencer_StackCmdDirective &directive) override
Internal interface handler for directive_stackCmd.
void directive_discard_internalInterfaceHandler(const Svc::FpySequencer_DiscardDirective &directive) override
Internal interface handler for directive_discard.
FpySequencer_ReturnDirective returnDirective
FpySequencer_AllocateDirective allocate
pop two byte arrays off the top of the stack, call memcmp, push 1 if they were equal, 0 otherwise
void tlmWrite_handler(FwIndexType portNum, U32 context) override
Handler for input port tlmWrite.
pops a severity and message from the stack and emits an F Prime event
void pushZeroes(Fpy::StackSizeType byteCount)
FpySequencer_StoreAbsDirective storeAbs
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
stores a value to an absolute address in the stack (for global variables), const offset ...
FpySequencer_DiscardDirective discard
FpySequencer_PushPrmDirective pushPrm
External serialize buffer with no copy semantics.
FpySequencer_SequencerStateMachineStateMachineBase::State State
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive) override
Internal interface handler for directive_waitAbs.
Sequencer blocking state.
FpySequencer_PushRandDirective pushRand
void parameterUpdated(FwPrmIdType id) override
Called whenever a parameter is updated.
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive) override
Internal interface handler for directive_goto.
peeks at N bytes from the stack, starting from an offset relative to the top of the stack ...
bool Svc_FpySequencer_SequencerStateMachine_guard_shouldBreak(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
A generic interface for creating and comparing hash values.
Definition: Hash.hpp:24
void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator &allocator, FwSizeType bytes)
FpySequencer_MemCmpDirective memCmp
FpySequencer_StackCmdDirective stackCmd
void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize)
void directive_storeAbsConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsConstOffsetDirective &directive) override
Internal interface handler for directive_storeAbsConstOffset.
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
FpySequencer_PushTlmValDirective pushTlmVal
friend class FpySequencerTester
void directive_popEvent_internalInterfaceHandler(const Svc::FpySequencer_PopEventDirective &directive) override
Internal interface handler for directive_popEvent.
void seqCancelIn_handler(FwIndexType portNum) override
Memory Allocation base class.
void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) override
Handler for input port cmdResponseIn.
void checkTimers_handler(FwIndexType portNum, U32 context) override
Handler for input port checkTimers.
FpySequencer_StoreAbsConstOffsetDirective storeAbsConstOffset
loads a value from an absolute address in the stack (for global variables)
bool Svc_FpySequencer_SequencerStateMachine_guard_breakOnce(SmId smId, Svc_FpySequencer_SequencerStateMachine::Signal signal) const override
PlatformIndexType FwIndexType
pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
Fpy::StackSizeType size
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
void directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive) override
Internal interface handler for directive_storeAbs.
Defines a base class for a memory allocator for classes.
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.
FpySequencer_ExitDirective exit
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
Success/Failure.
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
void directive_pushTlmVal_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValDirective &directive) override
Internal interface handler for directive_pushTlmVal.
FpySequencer(const char *const compName)
#define U64(C)
Definition: sha.h:181