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 
11 #include "Fw/Types/StringBase.hpp"
13 #include "Fw/Types/WaitEnumAc.hpp"
14 #include "Os/File.hpp"
25 
26 static_assert(Svc::Fpy::MAX_SEQUENCE_ARG_COUNT <= std::numeric_limits<U8>::max(),
27  "Sequence arg count must be below U8 max");
28 static_assert(Svc::Fpy::MAX_SEQUENCE_STATEMENT_COUNT <= std::numeric_limits<U16>::max(),
29  "Sequence statement count must be below U16 max");
30 static_assert(Svc::Fpy::MAX_STACK_SIZE <= std::numeric_limits<Svc::Fpy::StackSizeType>::max(),
31  "Max stack size must be below Svc::Fpy::StackSizeType max");
32 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_TLM_BUFFER_MAX_SIZE),
33  "Max stack size must be greater than max tlm buffer size");
34 static_assert(Svc::Fpy::MAX_STACK_SIZE >= static_cast<FwSizeType>(FW_PARAM_BUFFER_MAX_SIZE),
35  "Max stack size must be greater than max prm buffer size");
36 
37 namespace Svc {
38 
42 
44  friend class FpySequencerTester;
45 
46  public:
76 
79  };
80 
81  class Stack {
82  public:
83  // the byte array of the program stack, storing lvars, operands and function calls
85  // how many bytes high the stack is
87  // the byte offset from the start of the stack where the current function's local variables begin.
88  // analogous to a 'frame pointer'.
90 
91  // pops a value off of the top of the stack
92  // converts it from big endian
93  template <typename T>
94  T pop();
95 
96  // pushes a value onto the top of the stack
97  // converts it to big endian
98  template <typename T>
99  void push(T val);
100 
101  // pops a byte array from the top of the stack into the destination array
102  // does not convert endianness
103  void pop(U8* dest, Fpy::StackSizeType size);
104 
105  // pushes a byte array to the top of the stack from the source array
106  // leaves the source array unmodified
107  // does not convert endianness
108  void push(const U8* src, Fpy::StackSizeType size);
109 
110  // pushes zero bytes to the stack
111  void pushZeroes(Fpy::StackSizeType byteCount);
112 
113  // returns a pointer to the next unused byte at the top of the stack
114  U8* top();
115 
116  // Copies data from one region of the stack to another
117  // Asserts that both regions are within bounds and do not overlap
118  // Does not modify stack size
119  void copy(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType copySize);
120 
121  // Moves data within the stack (handles overlapping regions)
122  // Asserts that both source and destination are within bounds
123  // Does not modify stack size
124  void move(Fpy::StackSizeType destOffset, Fpy::StackSizeType srcOffset, Fpy::StackSizeType moveSize);
125  };
126 
127  // ----------------------------------------------------------------------
128  // Construction, initialization, and destruction
129  // ----------------------------------------------------------------------
130 
133  FpySequencer(const char* const compName
134  );
135 
138  ~FpySequencer();
139 
140  private:
144  void RUN_cmdHandler(FwOpcodeType opCode,
145  U32 cmdSeq,
146  const Fw::CmdStringArg& fileName,
147  BlockState block
148  ) override;
149 
151  void RUN_ARGS_cmdHandler(FwOpcodeType opCode,
152  U32 cmdSeq,
153  const Fw::CmdStringArg& fileName,
154  BlockState block,
155  Svc::SeqArgs args
156  ) override;
157 
161  void VALIDATE_cmdHandler(FwOpcodeType opCode,
162  U32 cmdSeq,
163  const Fw::CmdStringArg& fileName
164  ) override;
165 
169  void VALIDATE_ARGS_cmdHandler(FwOpcodeType opCode,
170  U32 cmdSeq,
171  const Fw::CmdStringArg& fileName,
172  Svc::SeqArgs buffer
173  ) override;
174 
178  void RUN_VALIDATED_cmdHandler(FwOpcodeType opCode,
179  U32 cmdSeq,
180  Svc::BlockState block
181  ) override;
182 
186  void CANCEL_cmdHandler(FwOpcodeType opCode,
187  U32 cmdSeq
188  ) override;
189 
196  void SET_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
197  U32 cmdSeq,
198  U32 stmtIdx,
199  bool breakOnce
200  ) override;
201 
207  void BREAK_cmdHandler(FwOpcodeType opCode,
208  U32 cmdSeq
209  ) override;
210 
215  void CONTINUE_cmdHandler(FwOpcodeType opCode,
216  U32 cmdSeq
217  ) override;
218 
223  void CLEAR_BREAKPOINT_cmdHandler(FwOpcodeType opCode,
224  U32 cmdSeq
225  ) override;
226 
232  void STEP_cmdHandler(FwOpcodeType opCode,
233  U32 cmdSeq
234  ) override;
235 
239  void DUMP_STACK_TO_FILE_cmdHandler(FwOpcodeType opCode,
240  U32 cmdSeq,
241  const Fw::CmdStringArg& fileName
242  ) override;
243 
244  // ----------------------------------------------------------------------
245  // Functions to implement for internal state machine actions
246  // ----------------------------------------------------------------------
247 
251  void Svc_FpySequencer_SequencerStateMachine_action_signalEntered(
252  SmId smId,
254  ) override;
255 
259  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceFilePath(
260  SmId smId,
263  ) override;
264 
268  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceBlockState(
269  SmId smId,
272  ) override;
273 
277  void Svc_FpySequencer_SequencerStateMachine_action_setSequenceArguments(
278  SmId smId,
281  ) override;
282 
286  void Svc_FpySequencer_SequencerStateMachine_action_validate(
287  SmId smId,
289  ) override;
290 
294  void Svc_FpySequencer_SequencerStateMachine_action_report_seqSucceeded(
295  SmId smId,
297  ) override;
298 
302  void Svc_FpySequencer_SequencerStateMachine_action_report_seqCancelled(
303  SmId smId,
305  ) override;
306 
310  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_RUNNING(
311  SmId smId,
313  ) override;
314 
318  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_VALID(
319  SmId smId,
321  ) override;
322 
326  void Svc_FpySequencer_SequencerStateMachine_action_setGoalState_IDLE(
327  SmId smId,
329  ) override;
330 
334  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_OK(
335  SmId smId,
337  ) override;
338 
343  void Svc_FpySequencer_SequencerStateMachine_action_sendCmdResponse_EXECUTION_ERROR(
344  SmId smId,
346  ) override;
347 
351  void Svc_FpySequencer_SequencerStateMachine_action_dispatchStatement(
352  SmId smId,
354  ) override;
355 
359  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceFile(
360  SmId smId,
362  ) override;
363 
367  void Svc_FpySequencer_SequencerStateMachine_action_clearSequenceArguments(
368  SmId smId,
370  ) override;
371 
375  void Svc_FpySequencer_SequencerStateMachine_action_checkShouldWake(
376  SmId smId,
378  ) override;
379 
383  void Svc_FpySequencer_SequencerStateMachine_action_resetRuntime(
384  SmId smId,
386  ) override;
387 
391  void Svc_FpySequencer_SequencerStateMachine_action_checkStatementTimeout(
392  SmId smId,
394  ) override;
395 
399  void Svc_FpySequencer_SequencerStateMachine_action_incrementSequenceCounter(
400  SmId smId,
402  ) override;
403 
407  void Svc_FpySequencer_SequencerStateMachine_action_pushArgsToStack(
408  SmId smId,
410  ) override;
411 
415  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakpoint(
416  SmId smId,
418  ) override;
419 
423  void Svc_FpySequencer_SequencerStateMachine_action_report_seqBroken(
424  SmId smId,
426  ) override;
427 
431  void Svc_FpySequencer_SequencerStateMachine_action_setBreakpoint(
432  SmId smId,
435  ) override;
436 
440  void Svc_FpySequencer_SequencerStateMachine_action_setBreakBeforeNextLine(
441  SmId smId,
443  ) override;
444 
448  void Svc_FpySequencer_SequencerStateMachine_action_clearBreakBeforeNextLine(
449  SmId smId,
451  ) override;
452 
456  void Svc_FpySequencer_SequencerStateMachine_action_report_seqFailed(
457  SmId smId,
459  ) override;
460 
464  void Svc_FpySequencer_SequencerStateMachine_action_report_seqStarted(
465  SmId smId,
467  ) override;
468 
469  protected:
470  // ----------------------------------------------------------------------
471  // Functions to implement for internal state machine guards
472  // ----------------------------------------------------------------------
473 
478  SmId smId,
480  ) const override;
481 
487  SmId smId,
489  ) const override;
490 
495  SmId smId,
497  ) const override;
498 
499  // ----------------------------------------------------------------------
500  // Handlers to implement for typed input ports
501  // ----------------------------------------------------------------------
502 
504  void checkTimers_handler(FwIndexType portNum,
505  U32 context
506  ) override;
507 
509  void cmdResponseIn_handler(FwIndexType portNum,
510  FwOpcodeType opCode,
511  U32 cmdSeq,
512  const Fw::CmdResponse& response
513  ) override;
514 
516  void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase& filename, const Svc::SeqArgs& args) override;
517 
521  void seqCancelIn_handler(FwIndexType portNum
522  ) override;
523 
525  void pingIn_handler(FwIndexType portNum,
526  U32 key
527  ) override;
528 
530  void tlmWrite_handler(FwIndexType portNum,
531  U32 context
532  ) override;
533 
536 
539 
542 
545 
548 
551 
554  const Svc::FpySequencer_PushTlmValAndTimeDirective& directive) override;
555 
558 
561 
564 
567 
570 
573  const Svc::FpySequencer_StoreRelConstOffsetDirective& directive) override;
574 
577 
580 
583 
586 
589 
592 
595 
598 
601 
604 
607 
610 
613 
616  const Svc::FpySequencer_StoreAbsConstOffsetDirective& directive) override;
617 
620 
621  void parametersLoaded() override;
622  void parameterUpdated(FwPrmIdType id) override;
623 
624  public:
625  void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator& allocator, FwSizeType bytes);
626 
627  void deallocateBuffer(Fw::MemAllocator& allocator);
628 
629  private:
630  static constexpr U32 CRC_INITIAL_VALUE = 0xFFFFFFFFU;
631 
632  // allocated at startup
633  Fw::ExternalSerializeBuffer m_sequenceBuffer;
634  // id of allocator that gave us m_sequenceBuffer
635  FwEnumStoreType m_allocatorId;
636 
637  // assigned by the user via cmd
638  Fw::String m_sequenceFilePath;
639  // the sequence, loaded in memory
640  Fpy::Sequence m_sequenceObj;
641  // live running computation of CRC (updated as we read)
642  U32 m_computedCRC;
643 
644  // whether or not the sequence we're about to run should return immediately or
645  // block on completion
646  BlockState m_sequenceBlockState;
647  // if we are to block on completion, save the opCode and cmdSeq we should
648  // return
649  FwOpcodeType m_savedOpCode;
650  U32 m_savedCmdSeq;
651 
652  // sequence arguments to push to stack when entering RUNNING state
653  Svc::SeqArgs m_sequenceArgs{};
654 
655  // the goal state is the state that we're trying to reach in the sequencer
656  // if it's RUNNING, then we should promptly go to RUNNING once we validate the
657  // sequence. if it's VALID, we should wait after VALIDATING
658  FpySequencer_GoalState m_goalState;
659 
660  // the total number of sequences this sequencer has started since construction
661  U64 m_sequencesStarted;
662  // the total number of statements this sequencer has dispatched, successfully or
663  // otherwise, since construction
664  U64 m_statementsDispatched;
665 
666  // the runtime state of the sequence. encapsulates all state
667  // needed to run the sequence.
668  // this is distinct from the state of the sequencer. the
669  // sequencer and all its state is really just a shell to load
670  // and execute this runtime.
671  struct Runtime {
672  // the index of the next statement to be executed
673  U32 nextStatementIndex = 0;
674 
675  // the opcode of the statement that is currently executing
676  U8 currentStatementOpcode = Fpy::DirectiveId::INVALID;
677  // the opcode of the command that we are currently awaiting, or 0 if we are executing a directive
678  FwOpcodeType currentCmdOpcode = 0;
679  // the time we dispatched the statement that is currently executing
680  Fw::Time currentStatementDispatchTime = Fw::Time();
681 
682  // the absolute time we should wait for until returning
683  // a statement response
684  Fw::Time wakeupTime = Fw::Time();
685 
686  Stack stack = Stack();
687  } m_runtime;
688 
689  // the state of the debugger. debugger is separate from runtime
690  // because it can be set up before running the sequence.
691  struct BreakpointInfo {
692  // whether or not to break at the debug breakpoint index
693  bool breakpointInUse = false;
694  // whether or not to remove the breakpoint after breaking on it
695  bool breakOnlyOnceOnBreakpoint = false;
696  // the statement index at which to break, before dispatching
697  U32 breakpointIndex = 0;
698  // whether or not to break before dispatching the next line,
699  // independent of what line it is.
700  // can be used in combination with breakpointIndex
701  bool breakBeforeNextLine = false;
702  } m_breakpoint;
703 
704  // debug information about the sequence. only valid in the PAUSED state
705  // which you can access via BREAK or SET_BREAKPOINT cmds
706  struct DebugInfo {
707  // true if there are no statements remaining in the sequence file
708  bool reachedEndOfFile = false;
709  // true if we were able to deserialize the next statement successfully
710  bool nextStatementReadSuccess = false;
711  // the opcode of the next statement to dispatch.
712  U8 nextStatementOpcode = 0;
713  // if the next statement is a cmd directive, the opcode of that cmd
714  FwOpcodeType nextCmdOpcode = 0;
715  // the index of the next statement we're going to execute
716  U32 nextStatementIndex = 0;
717  // the size of the stack. store this separately from the real stack size
718  // so we can avoid changing this during runtime, only modify it during
719  // debug
720  Fpy::StackSizeType stackSize = 0;
721  } m_debug;
722 
723  struct Telemetry {
724  // the number of statements that failed to execute
725  U64 statementsFailed = 0;
726  // the number of sequences successfully completed
727  U64 sequencesSucceeded = 0;
728  // the number of sequences that failed to validate or execute
729  U64 sequencesFailed = 0;
730  // the number of sequences that have been cancelled
731  U64 sequencesCancelled = 0;
732 
733  // the error code of the last directive that ran
734  DirectiveError lastDirectiveError = DirectiveError::NO_ERROR;
735  // the index of the last directive that errored
736  U64 directiveErrorIndex = 0;
737  // the opcode of the last directive that errored
738  Fpy::DirectiveId directiveErrorId = Fpy::DirectiveId::INVALID;
739  } m_tlm;
740 
741  // ----------------------------------------------------------------------
742  // Validation state
743  // ----------------------------------------------------------------------
744 
745  static void updateCrc(U32& crc,
746  const U8* buffer,
747  FwSizeType bufferSize
748  );
749 
750  // loads the sequence in memory, and does header/crc/integrity checks.
751  // return SUCCESS if sequence is valid, FAILURE otherwise
752  Fw::Success validate();
753  // reads and validates the header from the m_sequenceBuffer
754  // return SUCCESS if sequence is valid, FAILURE otherwise
755  Fw::Success readHeader();
756  // reads and validates the body from the m_sequenceBuffer
757  // return SUCCESS if sequence is valid, FAILURE otherwise
758  Fw::Success readBody();
759  // reads and validates the footer from the m_sequenceBuffer
760  // return SUCCESS if sequence is valid, FAILURE otherwise
761  Fw::Success readFooter();
762 
763  // reads some bytes from the open file into the m_sequenceBuffer.
764  // updates the CRC by default, but can be turned off if the contents
765  // aren't included in CRC.
766  // return success if successful
767  Fw::Success readBytes(Os::File& file,
768  FwSizeType readLen,
769  const FpySequencer_FileReadStage& readStage,
770  bool updateCrc = true);
771 
772  // ----------------------------------------------------------------------
773  // Run state
774  // ----------------------------------------------------------------------
775 
776  // utility method for updating telemetry based on a directive error code
777  void handleDirectiveErrorCode(Fpy::DirectiveId id, DirectiveError err);
778 
779  // dispatches the next statement
780  Signal dispatchStatement();
781 
782  // deserializes a directive from bytes into the Fpy type
783  // returns success if able to deserialize, and returns the Fpy type object
784  // as a reference, in a union of all the possible directive type objects
785  Fw::Success deserializeDirective(const Fpy::Statement& stmt, DirectiveUnion& deserializedDirective);
786 
787  // dispatches a deserialized sequencer directive to the right handler.
788  void dispatchDirective(const DirectiveUnion& directive, const Fpy::DirectiveId& id);
789 
790  // checks whether the currently executing statement timed out
791  Signal checkStatementTimeout();
792 
793  // checks whether the sequencer should wake from sleeping
794  Signal checkShouldWake();
795 
796  // return true if state is a substate of RUNNING
797  bool isRunningState(State state);
798 
799  // update a struct containing debug telemetry, or defaults if not in debug break
800  void updateDebugTelemetryStruct();
801 
802  // ----------------------------------------------------------------------
803  // Directives
804  // ----------------------------------------------------------------------
805 
806  // sends a signal based on a signal id
807  void sendSignal(Signal signal);
808 
809  // dispatches a command, returns whether successful or not
810  Fw::Success sendCmd(FwOpcodeType opcode, const U8* argBuf, FwSizeType argBufSize);
811 
812  // returns the index of the current statement
813  U32 currentStatementIdx();
814 
815  // we split these functions up into the internalInterfaceInvoke and these custom member funcs
816  // so that we can unit test them easier
817  Signal waitRel_directiveHandler(const FpySequencer_WaitRelDirective& directive, DirectiveError& error);
818  Signal waitAbs_directiveHandler(const FpySequencer_WaitAbsDirective& directive, DirectiveError& error);
819  Signal goto_directiveHandler(const FpySequencer_GotoDirective& directive, DirectiveError& error);
820  Signal if_directiveHandler(const FpySequencer_IfDirective& directive, DirectiveError& error);
821  Signal noOp_directiveHandler(const FpySequencer_NoOpDirective& directive, DirectiveError& error);
822  Signal pushTlmVal_directiveHandler(const FpySequencer_PushTlmValDirective& directive, DirectiveError& error);
823  Signal pushTlmValAndTime_directiveHandler(const FpySequencer_PushTlmValAndTimeDirective& directive,
824  DirectiveError& error);
825  Signal pushPrm_directiveHandler(const FpySequencer_PushPrmDirective& directive, DirectiveError& error);
826  Signal constCmd_directiveHandler(const FpySequencer_ConstCmdDirective& directive, DirectiveError& error);
827  Signal stackOp_directiveHandler(const FpySequencer_StackOpDirective& directive, DirectiveError& error);
828 
829  DirectiveError op_or();
830  DirectiveError op_and();
831  DirectiveError op_ieq();
832  DirectiveError op_ine();
833  DirectiveError op_ult();
834  DirectiveError op_ule();
835  DirectiveError op_ugt();
836  DirectiveError op_uge();
837  DirectiveError op_slt();
838  DirectiveError op_sle();
839  DirectiveError op_sgt();
840  DirectiveError op_sge();
841  DirectiveError op_feq();
842  DirectiveError op_fne();
843  DirectiveError op_flt();
844  DirectiveError op_fle();
845  DirectiveError op_fgt();
846  DirectiveError op_fge();
847  DirectiveError op_not();
848  DirectiveError op_fpext();
849  DirectiveError op_fptrunc();
850  DirectiveError op_fptoui();
851  DirectiveError op_fptosi();
852  DirectiveError op_sitofp();
853  DirectiveError op_uitofp();
854  DirectiveError op_add();
855  DirectiveError op_sub();
856  DirectiveError op_mul();
857  DirectiveError op_udiv();
858  DirectiveError op_sdiv();
859  DirectiveError op_umod();
860  DirectiveError op_smod();
861  DirectiveError op_fadd();
862  DirectiveError op_fsub();
863  DirectiveError op_fmul();
864  DirectiveError op_fdiv();
865  DirectiveError op_float_floor_div();
866  DirectiveError op_fpow();
867  DirectiveError op_flog();
868  DirectiveError op_fmod();
869  DirectiveError op_siext_8_64();
870  DirectiveError op_siext_16_64();
871  DirectiveError op_siext_32_64();
872  DirectiveError op_ziext_8_64();
873  DirectiveError op_ziext_16_64();
874  DirectiveError op_ziext_32_64();
875  DirectiveError op_itrunc_64_8();
876  DirectiveError op_itrunc_64_16();
877  DirectiveError op_itrunc_64_32();
878 
879  Signal exit_directiveHandler(const FpySequencer_ExitDirective& directive, DirectiveError& error);
880  Signal allocate_directiveHandler(const FpySequencer_AllocateDirective& directive, DirectiveError& error);
882  Signal storeHelper(Fpy::StackSizeType destOffset, Fpy::StackSizeType size, DirectiveError& error);
884  Signal loadHelper(Fpy::StackSizeType srcOffset, Fpy::StackSizeType size, DirectiveError& error);
885  Signal storeRelConstOffset_directiveHandler(const FpySequencer_StoreRelConstOffsetDirective& directive,
886  DirectiveError& error);
887  Signal loadRel_directiveHandler(const FpySequencer_LoadRelDirective& directive, DirectiveError& error);
888  Signal pushVal_directiveHandler(const FpySequencer_PushValDirective& directive, DirectiveError& error);
889  Signal discard_directiveHandler(const FpySequencer_DiscardDirective& directive, DirectiveError& error);
890  Signal memCmp_directiveHandler(const FpySequencer_MemCmpDirective& directive, DirectiveError& error);
891  Signal stackCmd_directiveHandler(const FpySequencer_StackCmdDirective& directive, DirectiveError& error);
892  Signal pushTime_directiveHandler(const FpySequencer_PushTimeDirective& directive, DirectiveError& error);
893  Signal getField_directiveHandler(const FpySequencer_GetFieldDirective& directive, DirectiveError& error);
894  Signal peek_directiveHandler(const FpySequencer_PeekDirective& directive, DirectiveError& error);
895  Signal storeRel_directiveHandler(const FpySequencer_StoreRelDirective& directive, DirectiveError& error);
896  Signal call_directiveHandler(const FpySequencer_CallDirective& directive, DirectiveError& error);
897  Signal return_directiveHandler(const FpySequencer_ReturnDirective& directive, DirectiveError& error);
898  Signal loadAbs_directiveHandler(const FpySequencer_LoadAbsDirective& directive, DirectiveError& error);
899  Signal storeAbs_directiveHandler(const FpySequencer_StoreAbsDirective& directive, DirectiveError& error);
900  Signal storeAbsConstOffset_directiveHandler(const FpySequencer_StoreAbsConstOffsetDirective& directive,
901  DirectiveError& error);
902  Signal popEvent_directiveHandler(const FpySequencer_PopEventDirective& directive, DirectiveError& error);
903 };
904 
905 } // namespace Svc
906 
907 #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
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
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.
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
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
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.
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