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 
545 
548 
551 
554 
557 
560  const Svc::FpySequencer_PushTlmValAndTimeDirective& directive) override;
561 
564 
567 
570 
573 
576 
579  const Svc::FpySequencer_StoreRelConstOffsetDirective& directive) override;
580 
583 
586 
589 
592 
595 
598 
601 
604 
607 
610 
613 
616 
619 
622 
625 
628  const Svc::FpySequencer_StoreAbsConstOffsetDirective& directive) override;
629 
632 
635  const Svc::FpySequencer_PopSerializableDirective& directive) override;
636 
637  void parametersLoaded() override;
638  void parameterUpdated(FwPrmIdType id) override;
639 
640  public:
641  void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator& allocator, FwSizeType bytes);
642 
643  void deallocateBuffer(Fw::MemAllocator& allocator);
644 
645  private:
646  static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
647 
648  // allocated at startup
649  Fw::ExternalSerializeBuffer m_sequenceBuffer;
650  // id of allocator that gave us m_sequenceBuffer
651  FwEnumStoreType m_allocatorId;
652 
653  // assigned by the user via cmd
654  // length is FileNameStringSize
655  Fw::FileNameString m_sequenceFilePath;
656  // the sequence, loaded in memory
657  Fpy::Sequence m_sequenceObj;
658  // live running computation of CRC (updated as we read)
659  Utils::Hash m_computedCRC;
660 
661  // Size of arguments read in current sequence. Used for validation between
662  // User provided arguments and what is requested of the sequence.
663  Fpy::StackSizeType m_totalExpectedArgSize;
664 
665  // whether or not the sequence we're about to run should return immediately or
666  // block on completion
667  Svc::BlockState m_sequenceBlockState;
668  // if we are to block on completion, save the opCode and cmdSeq we should
669  // return
670  FwOpcodeType m_savedOpCode;
671  U32 m_savedCmdSeq;
672 
673  // sequence arguments to push to stack when entering RUNNING state
674  Svc::SeqArgs m_sequenceArgs{};
675 
676  // the goal state is the state that we're trying to reach in the sequencer
677  // if it's RUNNING, then we should promptly go to RUNNING once we validate the
678  // sequence. if it's VALID, we should wait after VALIDATING
679  FpySequencer_GoalState m_goalState;
680 
681  // the total number of sequences this sequencer has started since construction
682  U64 m_sequencesStarted;
683  // the total number of statements this sequencer has dispatched, successfully or
684  // otherwise, since construction
685  U64 m_statementsDispatched;
686 
687  // the runtime state of the sequence. encapsulates all state
688  // needed to run the sequence.
689  // this is distinct from the state of the sequencer. the
690  // sequencer and all its state is really just a shell to load
691  // and execute this runtime.
692  struct Runtime {
693  // the index of the next statement to be executed
694  U32 nextStatementIndex = 0;
695 
696  // the opcode of the statement that is currently executing
697  U8 currentStatementOpcode = Fpy::DirectiveId::INVALID;
698  // the opcode of the command that we are currently awaiting, or 0 if we are executing a directive
699  FwOpcodeType currentCmdOpcode = 0;
700  // the time we dispatched the statement that is currently executing
701  Fw::Time currentStatementDispatchTime = Fw::Time();
702 
703  // the absolute time we should wait for until returning
704  // a statement response
705  Fw::Time wakeupTime = Fw::Time();
706 
707  // RNG state used by PUSH_RAND and SET_SEED directives during this run
708  std::mt19937 rng;
709  bool rngSeeded = false;
710 
711  Stack stack = Stack();
712  } m_runtime;
713 
714  // the state of the debugger. debugger is separate from runtime
715  // because it can be set up before running the sequence.
716  struct BreakpointInfo {
717  // whether or not to break at the debug breakpoint index
718  bool breakpointInUse = false;
719  // whether or not to remove the breakpoint after breaking on it
720  bool breakOnlyOnceOnBreakpoint = false;
721  // the statement index at which to break, before dispatching
722  U32 breakpointIndex = 0;
723  // whether or not to break before dispatching the next line,
724  // independent of what line it is.
725  // can be used in combination with breakpointIndex
726  bool breakBeforeNextLine = false;
727  } m_breakpoint;
728 
729  // debug information about the sequence. only valid in the PAUSED state
730  // which you can access via BREAK or SET_BREAKPOINT cmds
731  struct DebugInfo {
732  // true if there are no statements remaining in the sequence file
733  bool reachedEndOfFile = false;
734  // true if we were able to deserialize the next statement successfully
735  bool nextStatementReadSuccess = false;
736  // the opcode of the next statement to dispatch.
737  U8 nextStatementOpcode = 0;
738  // if the next statement is a cmd directive, the opcode of that cmd
739  FwOpcodeType nextCmdOpcode = 0;
740  // the index of the next statement we're going to execute
741  U32 nextStatementIndex = 0;
742  // the size of the stack. store this separately from the real stack size
743  // so we can avoid changing this during runtime, only modify it during
744  // debug
745  Fpy::StackSizeType stackSize = 0;
746  } m_debug;
747 
748  struct Telemetry {
749  // the number of statements that failed to execute
750  U64 statementsFailed = 0;
751  // the number of sequences successfully completed
752  U64 sequencesSucceeded = 0;
753  // the number of sequences that failed to validate or execute
754  U64 sequencesFailed = 0;
755  // the number of sequences that have been cancelled
756  U64 sequencesCancelled = 0;
757 
758  // the error code of the last directive that ran
759  DirectiveError lastDirectiveError = DirectiveError::NO_ERROR;
760  // the index of the last directive that errored
761  U64 directiveErrorIndex = 0;
762  // the opcode of the last directive that errored
763  Fpy::DirectiveId directiveErrorId = Fpy::DirectiveId::INVALID;
764  } m_tlm;
765 
766  // ----------------------------------------------------------------------
767  // Validation state
768  // ----------------------------------------------------------------------
769 
770  // loads the sequence in memory, and does header/crc/integrity checks.
771  // return SUCCESS if sequence is valid, FAILURE otherwise
772  Fw::Success validate();
773  // reads and validates the header from the m_sequenceBuffer
774  // return SUCCESS if sequence is valid, FAILURE otherwise
775  Fw::Success readHeader();
776  // reads and validates the body from the m_sequenceBuffer
777  // return SUCCESS if sequence is valid, FAILURE otherwise
778  Fw::Success readBody();
779  // reads and validates the footer from the m_sequenceBuffer
780  // return SUCCESS if sequence is valid, FAILURE otherwise
781  Fw::Success readFooter();
782 
783  // reads some bytes from the open file into the m_sequenceBuffer.
784  // updates the CRC by default, but can be turned off if the contents
785  // aren't included in CRC.
786  // return success if successful
787  Fw::Success readBytes(Os::File& file,
788  FwSizeType readLen,
789  const FpySequencer_FileReadStage& readStage,
790  bool updateCrc = true);
791 
792  // ----------------------------------------------------------------------
793  // Run state
794  // ----------------------------------------------------------------------
795 
796  // utility method for updating telemetry based on a directive error code
797  void handleDirectiveErrorCode(Fpy::DirectiveId id, DirectiveError err);
798 
799  // dispatches the next statement
800  Signal dispatchStatement();
801 
802  // deserializes a directive from bytes into the Fpy type
803  // returns success if able to deserialize, and returns the Fpy type object
804  // as a reference, in a union of all the possible directive type objects
805  Fw::Success deserializeDirective(const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
806 
807  // dispatches a deserialized sequencer directive to the right handler.
808  void dispatchDirective(const DirectiveUnion& directive, const Fpy::DirectiveId& id);
809 
810  // checks whether the currently executing statement timed out
811  Signal checkStatementTimeout();
812 
813  // checks whether the sequencer should wake from sleeping
814  Signal checkShouldWake();
815 
816  // return true if state is a substate of RUNNING
817  bool isRunningState(State state);
818 
819  // update a struct containing debug telemetry, or defaults if not in debug break
820  void updateDebugTelemetryStruct();
821 
822  // ----------------------------------------------------------------------
823  // Directives
824  // ----------------------------------------------------------------------
825 
826  // sends a signal based on a signal id
827  void sendSignal(Signal signal);
828 
829  // dispatches a command, returns whether successful or not
830  Fw::Success sendCmd(FwOpcodeType opcode, const U8* argBuf, FwSizeType argBufSize);
831 
832  // returns the index of the current statement
833  U32 currentStatementIdx();
834 
835  // we split these functions up into the internalInterfaceInvoke and these custom member funcs
836  // so that we can unit test them easier
837  Signal waitRel_directiveHandler(const FpySequencer_WaitRelDirective& directive, DirectiveError& error);
838  Signal waitAbs_directiveHandler(const FpySequencer_WaitAbsDirective& directive, DirectiveError& error);
839  Signal goto_directiveHandler(const FpySequencer_GotoDirective& directive, DirectiveError& error);
840  Signal if_directiveHandler(const FpySequencer_IfDirective& directive, DirectiveError& error);
841  Signal noOp_directiveHandler(const FpySequencer_NoOpDirective& directive, DirectiveError& error);
842  Signal pushTlmVal_directiveHandler(const FpySequencer_PushTlmValDirective& directive, DirectiveError& error);
843  Signal pushTlmValAndTime_directiveHandler(const FpySequencer_PushTlmValAndTimeDirective& directive,
844  DirectiveError& error);
845  Signal pushPrm_directiveHandler(const FpySequencer_PushPrmDirective& directive, DirectiveError& error);
846  Signal constCmd_directiveHandler(const FpySequencer_ConstCmdDirective& directive, DirectiveError& error);
847  Signal stackOp_directiveHandler(const FpySequencer_StackOpDirective& directive, DirectiveError& error);
848 
849  DirectiveError op_or();
850  DirectiveError op_and();
851  DirectiveError op_ieq();
852  DirectiveError op_ine();
853  DirectiveError op_ult();
854  DirectiveError op_ule();
855  DirectiveError op_ugt();
856  DirectiveError op_uge();
857  DirectiveError op_slt();
858  DirectiveError op_sle();
859  DirectiveError op_sgt();
860  DirectiveError op_sge();
861  DirectiveError op_feq();
862  DirectiveError op_fne();
863  DirectiveError op_flt();
864  DirectiveError op_fle();
865  DirectiveError op_fgt();
866  DirectiveError op_fge();
867  DirectiveError op_not();
868  DirectiveError op_fpext();
869  DirectiveError op_fptrunc();
870  DirectiveError op_fptoui();
871  DirectiveError op_fptosi();
872  DirectiveError op_sitofp();
873  DirectiveError op_uitofp();
874  DirectiveError op_add();
875  DirectiveError op_sub();
876  DirectiveError op_mul();
877  DirectiveError op_udiv();
878  DirectiveError op_sdiv();
879  DirectiveError op_umod();
880  DirectiveError op_smod();
881  DirectiveError op_fadd();
882  DirectiveError op_fsub();
883  DirectiveError op_fmul();
884  DirectiveError op_fdiv();
885  DirectiveError op_float_floor_div();
886  DirectiveError op_fpow();
887  DirectiveError op_flog();
888  DirectiveError op_fmod();
889  DirectiveError op_siext_8_64();
890  DirectiveError op_siext_16_64();
891  DirectiveError op_siext_32_64();
892  DirectiveError op_ziext_8_64();
893  DirectiveError op_ziext_16_64();
894  DirectiveError op_ziext_32_64();
895  DirectiveError op_itrunc_64_8();
896  DirectiveError op_itrunc_64_16();
897  DirectiveError op_itrunc_64_32();
898 
899  Signal exit_directiveHandler(const FpySequencer_ExitDirective& directive, DirectiveError& error);
900  Signal allocate_directiveHandler(const FpySequencer_AllocateDirective& directive, DirectiveError& error);
902  Signal storeHelper(Fpy::StackSizeType destOffset, Fpy::StackSizeType size, DirectiveError& error);
904  Signal loadHelper(Fpy::StackSizeType srcOffset, Fpy::StackSizeType size, DirectiveError& error);
905  Signal storeRelConstOffset_directiveHandler(const FpySequencer_StoreRelConstOffsetDirective& directive,
906  DirectiveError& error);
907  Signal loadRel_directiveHandler(const FpySequencer_LoadRelDirective& directive, DirectiveError& error);
908  Signal pushVal_directiveHandler(const FpySequencer_PushValDirective& directive, DirectiveError& error);
909  Signal discard_directiveHandler(const FpySequencer_DiscardDirective& directive, DirectiveError& error);
910  Signal memCmp_directiveHandler(const FpySequencer_MemCmpDirective& directive, DirectiveError& error);
911  Signal stackCmd_directiveHandler(const FpySequencer_StackCmdDirective& directive, DirectiveError& error);
912  Signal pushTime_directiveHandler(const FpySequencer_PushTimeDirective& directive, DirectiveError& error);
913  Signal setSeed_directiveHandler(const FpySequencer_SetSeedDirective& directive, DirectiveError& error);
914  Signal pushRand_directiveHandler(const FpySequencer_PushRandDirective& directive, DirectiveError& error);
915  Signal getField_directiveHandler(const FpySequencer_GetFieldDirective& directive, DirectiveError& error);
916  Signal peek_directiveHandler(const FpySequencer_PeekDirective& directive, DirectiveError& error);
917  Signal storeRel_directiveHandler(const FpySequencer_StoreRelDirective& directive, DirectiveError& error);
918  Signal call_directiveHandler(const FpySequencer_CallDirective& directive, DirectiveError& error);
919  Signal return_directiveHandler(const FpySequencer_ReturnDirective& directive, DirectiveError& error);
920  Signal loadAbs_directiveHandler(const FpySequencer_LoadAbsDirective& directive, DirectiveError& error);
921  Signal storeAbs_directiveHandler(const FpySequencer_StoreAbsDirective& directive, DirectiveError& error);
922  Signal storeAbsConstOffset_directiveHandler(const FpySequencer_StoreAbsConstOffsetDirective& directive,
923  DirectiveError& error);
924  Signal popEvent_directiveHandler(const FpySequencer_PopEventDirective& directive, DirectiveError& error);
925  Signal popSerializable_directiveHandler(const FpySequencer_PopSerializableDirective& directive,
926  DirectiveError& error);
927 };
928 
929 } // namespace Svc
930 
931 #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.
FpySequencer_PopSerializableDirective popSerializable
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
void directive_popSerializable_internalInterfaceHandler(const Svc::FpySequencer_PopSerializableDirective &directive) override
Internal interface handler for directive_popSerializable.
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:54
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
pops serialized data from stack and sends to serial output port
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