F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
WasmSequencer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title WasmSequencer.hpp
3 // \author tumbar
4 // \brief hpp file for WasmSequencer component implementation class
5 // ======================================================================
6 
7 #ifndef Svc_WasmSequencer_HPP
8 #define Svc_WasmSequencer_HPP
9 
10 #include <atomic>
11 
17 #include "Fw/Types/StringBase.hpp"
30 #include "config/WasmSequencerConfig.hpp"
31 
32 namespace Svc {
33 
35  friend class WasmSequencerTester;
36 
37  public:
38  // ----------------------------------------------------------------------
39  // Component construction and destruction
40  // ----------------------------------------------------------------------
41 
43  WasmSequencer(const char* const compName
44  );
45 
47  ~WasmSequencer() = default;
48 
51  WasmSequencer(const WasmSequencer&) = delete;
52  WasmSequencer& operator=(const WasmSequencer&) = delete;
53 
56  DROP_NEWEST,
57  DROP_OLDEST,
58  ASSERT,
60  };
61 
63  constexpr static FwSizeType SPACEWASM_MEMORY_ALIGNMENT = 8;
64 
68  constexpr static FwSizeType SPACEWASM_IR_PAGE_SIZE = 512;
70  "SpaceWasm does not support dynamic memory pages smaller than a single IR page (512 bytes)");
71 
78  };
79 
82  struct Config {
88 
93 
100 
113 
116 
121 
127  };
128 
131  void configure(const Config& cfg, Fw::MemAllocator& mallocator);
132 
134  void deinit() override;
135 
136  private:
137  // ----------------------------------------------------------------------
138  // Handler implementations for typed input ports
139  // ----------------------------------------------------------------------
140 
144  void checkTimers_handler(FwIndexType portNum,
145  U32 context
146  ) override;
147 
151  void cmdResponseIn_handler(FwIndexType portNum,
152  FwOpcodeType opCode,
153  U32 cmdSeq,
154  const Fw::CmdResponse& response
155  ) override;
156 
160  void seqCancelIn_handler(FwIndexType portNum
161  ) override;
162 
166  void seqRunIn_handler(FwIndexType portNum,
167  const Fw::StringBase& filename,
168  const Svc::SeqArgs& args
169  ) override;
170 
174  void writeTelemetry_handler(FwIndexType portNum,
175  U32 context
176  ) override;
177 
179  void writeTelemetryInternal_internalInterfaceHandler() override;
180 
182  void writeTelemetryInternal_overflowHook() override;
183 
184  private:
185  // ----------------------------------------------------------------------
186  // Handler implementations for serial input ports
187  // ----------------------------------------------------------------------
188 
194  void serialIn_handler(FwIndexType portNum,
195  Fw::LinearBufferBase& buffer
196  ) override;
197 
198  private:
199  // ----------------------------------------------------------------------
200  // Handler implementations for commands
201  // ----------------------------------------------------------------------
202 
216  void RUN_cmdHandler(FwOpcodeType opCode,
217  U32 cmdSeq,
218  const Fw::CmdStringArg& fileName,
219  const Svc::BlockState& block
220  ) override;
221 
228  void LOAD_cmdHandler(FwOpcodeType opCode,
229  U32 cmdSeq,
230  const Fw::CmdStringArg& fileName,
231  const Fw::CmdStringArg& name
232  ) override;
233 
237  void INVOKE_cmdHandler(FwOpcodeType opCode,
238  U32 cmdSeq,
239  const Fw::CmdStringArg& module,
240  const Svc::BlockState& block
241  ) override;
242 
246  void WAIT_cmdHandler(FwOpcodeType opCode,
247  U32 cmdSeq
248  ) override;
249 
254  void CANCEL_cmdHandler(FwOpcodeType opCode,
255  U32 cmdSeq
256  ) override;
257 
265  void PAUSE_cmdHandler(FwOpcodeType opCode,
266  U32 cmdSeq
267  ) override;
268 
272  void CONTINUE_cmdHandler(FwOpcodeType opCode,
273  U32 cmdSeq
274  ) override;
275 
280  void GLOBAL_SET_I32_cmdHandler(FwOpcodeType opCode,
281  U32 cmdSeq,
282  const Fw::CmdStringArg& moduleName,
283  const Fw::CmdStringArg& name,
284  I32 value
285  ) override;
286 
291  void GLOBAL_SET_I64_cmdHandler(FwOpcodeType opCode,
292  U32 cmdSeq,
293  const Fw::CmdStringArg& moduleName,
294  const Fw::CmdStringArg& name,
295  I64 value
296  ) override;
297 
302  void GLOBAL_SET_F32_cmdHandler(FwOpcodeType opCode,
303  U32 cmdSeq,
304  const Fw::CmdStringArg& moduleName,
305  const Fw::CmdStringArg& name,
306  F32 value
307  ) override;
308 
313  void GLOBAL_SET_F64_cmdHandler(FwOpcodeType opCode,
314  U32 cmdSeq,
315  const Fw::CmdStringArg& moduleName,
316  const Fw::CmdStringArg& name,
317  F64 value
318  ) override;
319 
324  void GLOBAL_GET_cmdHandler(FwOpcodeType opCode,
325  U32 cmdSeq,
326  const Fw::CmdStringArg& moduleName,
327  const Fw::CmdStringArg& name
328  ) override;
329 
330  private:
331  // ----------------------------------------------------------------------
332  // Implementations for internal state machine actions
333  // ----------------------------------------------------------------------
334 
338  void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
339  SmId smId,
342  ) override;
343 
347  void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
348  SmId smId,
350  ) override;
351 
355  void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
356  SmId smId,
358  ) override;
359 
364  void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
365  SmId smId,
368  ) override;
369 
373  void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
374  SmId smId,
377  ) override;
378 
383  void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
384  SmId smId,
387  ) override;
388 
392  void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
393  SmId smId,
395  ) override;
396 
401  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
402  SmId smId,
405  ) override;
406 
411  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
412  SmId smId,
415  ) override;
416 
422  void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
423  SmId smId,
425  const Svc::WasmSequencer_LoadRequest& value
426  ) override;
427 
432  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
433  SmId smId,
436  ) override;
437 
442  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
443  SmId smId,
446  ) override;
447 
452  void Svc_WasmSequencer_ControllerStateMachine_action_load(
453  SmId smId,
455  const Svc::WasmSequencer_LoadRequest& value
456  ) override;
457 
461  void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
462  SmId smId,
465  ) override;
466 
470  void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
471  SmId smId,
474  ) override;
475 
479  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
480  SmId smId,
483  ) override;
484 
488  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
489  SmId smId,
492  ) override;
493 
498  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
499  SmId smId,
502  ) override;
503 
507  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
508  SmId smId,
511  ) override;
512 
516  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
517  SmId smId,
520  ) override;
521 
525  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
526  SmId smId,
529  ) override;
530 
534  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
535  SmId smId,
538  ) override;
539 
543  void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
544  SmId smId,
546  ) override;
547 
552  void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
553  SmId smId,
556  ) override;
557 
561  void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
562  SmId smId,
565  ) override;
566 
570  void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
571  SmId smId,
573  ) override;
574 
578  void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
579  SmId smId,
581  ) override;
582 
586  void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
587  SmId smId,
589  ) override;
590 
592  void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
593  SmId smId,
595  ) override;
596 
599  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
600  SmId smId,
602  ) override;
603 
606  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
607  SmId smId,
609  ) override;
610 
612  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
613  SmId smId,
615  ) override;
616 
618  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
619  SmId smId,
621  ) override;
622 
625  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
626  SmId smId,
628  ) override;
629 
632  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
633  SmId smId,
635  ) override;
636 
638  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
639  SmId smId,
641  ) override;
642 
644  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
645  SmId smId,
647  I32 value
648  ) override;
649 
651  void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
652  SmId smId,
654  const Svc::WasmSequencer_TrapReason& value
655  ) override;
656 
658  void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
659  SmId smId,
661  ) override;
662 
667  void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
668  SmId smId,
670  ) override;
671 
675  void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
676  SmId smId,
678  ) override;
679 
683  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
684  SmId smId,
686  ) override;
687 
691  void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
692  SmId smId,
694  ) override;
695 
699  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
700  SmId smId,
702  ) override;
703 
707  void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
708  SmId smId,
711  ) override;
712 
716  void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
717  SmId smId,
719  ) override;
720 
724  void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
725  SmId smId,
727  ) override;
728 
732  void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
733  SmId smId,
735  I32 value
736  ) override;
737 
741  void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
742  SmId smId,
744  ) override;
745 
749  void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
750  SmId smId,
752  ) override;
753 
757  void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
758  SmId smId,
760  const FwIndexType& value
761  ) override;
762 
763  private:
764  // ----------------------------------------------------------------------
765  // Implementations for internal state machine guards
766  // ----------------------------------------------------------------------
767 
771  bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
772  SmId smId,
774  ) const override;
775 
779  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
780  SmId smId,
783  ) const override;
784 
788  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
789  SmId smId,
792  ) const override;
793 
797  bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
798  SmId smId,
801  ) const override;
802 
806  bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
807  SmId smId,
809  ) const override;
810 
814  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
815  SmId smId,
817  ) const override;
818 
822  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
823  SmId smId,
825  ) const override;
826 
830  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
831  SmId smId,
833  ) const override;
834 
838  bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
839  SmId smId,
841  const FwIndexType& value
842  ) const override;
843 
847  bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
848  SmId smId,
850  ) const override;
851 
852  private:
854  U8* globalAlloc(U32 size, U32 align);
855  void globalDealloc(const U8* ptr);
856 
858  static U8* globalAllocCallback(void* userdata, size_t size, size_t align);
859  static void globalDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
860 
862  U8* guestAlloc(FwSizeType size, U32 align);
863  U8* guestRealloc(U8* ptr, FwSizeType oldSize, FwSizeType newSize, U32 align);
864  void guestDealloc(const U8* ptr, FwSizeType size);
865 
866  // Guest allocator callbacks passed to C API
867  static U8* guestAllocCallback(void* userdata, size_t size, size_t align);
868  static U8* guestReallocCallback(void* userdata, U8* ptr, size_t old_size, size_t new_size, size_t align);
869  static void guestDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
870 
873  void createStore();
874 
876  void destroyStore();
877 
879  void takeAllocatorLock();
880 
882  void releaseAllocatorLock();
883 
885  static Svc::WasmSequencer_TrapReason::T mapTrapReason(spacewasm_trap_t trap);
886 
890  void setSequenceName(const Fw::StringBase& filePath, const Fw::StringBase& moduleName);
891 
895  static const char* pathBaseName(const char* path, FwSizeType len, FwSizeType& outLen);
896 
900  static bool pathHasParentTraversal(const Fw::StringBase& path);
901 
906  bool resolveSequencePath(const Fw::StringBase& fileName, Fw::String& filePath);
907 
910  Fw::Success readGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, U8* dst, FwSizeType len);
911 
914  Fw::Success writeGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, const U8* src, FwSizeType len);
915 
916  Fw::MemAllocator* m_allocator = nullptr;
917 
919  Config m_config;
920 
924  U8** m_heapPages;
925 
927  FwSizeType m_heapPagesUsed;
928 
932  bool m_heapPoisoned;
933 
937  U8* m_guestPool;
938 
940  FwSizeType m_guestPoolOffset;
941 
943  spacewasm_t* m_wasm;
944 
946  spacewasm_allocator_t* m_guest_allocator;
947 
949  struct WaitingCmd {
950  FwOpcodeType opCode;
951  U32 cmdSeq;
952 
953  WaitingCmd() : opCode(0), cmdSeq(0) {}
954  WaitingCmd(FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
955  };
956 
959 
961  Fw::FileNameString m_lastLoadFileName;
962 
963  WasmSequencer_RequestContext m_executingContext;
964  bool m_hasExecutingContext;
965 
967  Fw::Time m_pendingTimer;
968  bool m_hasPendingTimer;
969 
973  Fw::Time m_hostFunctionStart;
974  bool m_hasHostFunctionStart;
975 
976  bool m_dequeueSucceeded;
977 
979  spacewasm_status_t m_invokeStatus;
980 
982  bool m_pendingPause;
983 
985  bool m_cancelRequested;
986 
989  struct Telemetry {
991  U64 sequencesSucceeded{0};
992 
994  U64 sequencesFailed{0};
995 
997  U64 sequencesCancelled{0};
998 
1000  U64 commandsDispatched{0};
1001 
1003  U64 commandsFailed{0};
1004 
1006  Fw::FileNameString sequenceName{""};
1007  };
1008 
1009  Telemetry m_tlm;
1010 
1012  std::atomic<bool> m_writeTelemetryQueued;
1013 
1018  U32 m_sequencesStarted;
1019 
1024  U32 makeCmdUid() const;
1025 
1028  struct ExitStatus {
1031  WasmSequencer_ExitReason reason{WasmSequencer_ExitReason::UNKNOWN};
1032 
1034  I32 code{0};
1035 
1037  WasmSequencer_HostFunction lastHostFunction{WasmSequencer_HostFunction::NONE};
1038 
1040  WasmSequencer_TrapReason lastTrapReason{WasmSequencer_TrapReason::NONE};
1041  };
1042 
1044  ExitStatus m_exit;
1045 
1047  Fw::ExternalSerializeBuffer m_serialOutBuffer;
1048 
1052 
1054  Os::Mutex m_serialInMutex;
1055 
1059  struct PendingHostFunction {
1060  PendingHostFunction() = default;
1061  bool isPending() const { return kind != WasmSequencer_HostFunction::NONE; }
1062  void clear() { kind = WasmSequencer_HostFunction::NONE; }
1063 
1064  WasmSequencer_HostFunction kind{WasmSequencer_HostFunction::NONE};
1065 
1066  // Handle that holds the Wasm guest memory pointer
1067  spacewasm_caller_t* caller{nullptr};
1068 
1070  union Args {
1071  // COMMAND: encoded command payload in guest memory
1072  struct {
1073  U32 ptr;
1074  U32 len;
1075  } command;
1076 
1077  // TELEMETRY: channel id plus where to write the serialized time and value
1078  struct {
1080  U32 timePtr;
1081  U32 timeLen;
1084  } telemetry;
1085 
1086  // PARAMETER: parameter id plus where to write the serialized value
1087  struct {
1089  U32 ptr;
1090  U32 len;
1091  } parameter;
1092 
1093  // EVENT: raw guest-requested severity (may be out of range) plus the message
1094  struct {
1096  U32 msgPtr;
1097  U32 msgLen;
1098  } event;
1099 
1100  // RSLEEP: relative sleep duration
1101  struct {
1102  U64 us;
1103  } rsleep;
1104 
1105  // ASLEEP: absolute sleep time
1106  struct {
1107  U64 us;
1108  } asleep;
1109 
1110  // TIME: where to write the serialized current time
1111  struct {
1112  U32 ptr;
1113  U32 len;
1114  } time;
1115 
1116  // SERIAL_OUT: serial output port index plus payload in guest memory
1117  struct {
1118  U32 index;
1119  U32 ptr;
1120  U32 len;
1121  } serialOut;
1122 
1123  // SERIAL_RECV: Read a message from the serialIn port queue given a port index
1124  struct {
1125  U32 index;
1126  U32 dataPtr;
1130  } serialRecv;
1131 
1132  Args() : command{0, 0} {}
1133  } u;
1134  };
1135 
1136  PendingHostFunction m_pendingHostFunction;
1137 
1139  spacewasm_status_t validateModuleMain(WasmSequencer_ModuleIdx moduleIdx) const;
1140 
1146  void reportSequenceRuntimeFailure(WasmSequencer_ModuleIdx moduleIdx, WasmSequencer_SequencePhase phase);
1147 
1149  void respondToRequest(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1150 
1152  void respondToWaiting(const Fw::CmdResponse& response);
1153 
1160  void reportSeqDone(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1161 
1165  void reportSeqAborted(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1166 
1168  spacewasm_status_t setGlobal(const Fw::StringBase& moduleName, const Fw::StringBase& name, spacewasm_value_t value);
1169 
1171  spacewasm_status_t getGlobal(const Fw::StringBase& moduleName,
1172  const Fw::StringBase& name,
1173  spacewasm_value_t& value);
1174 
1176  void hostFprimeV1(spacewasm_host_t*);
1177 
1179  spacewasm_hostcall_result_t wasmExit(struct spacewasm_caller_t* caller,
1180  const struct spacewasm_value_t* params,
1181  size_t n_params,
1182  struct spacewasm_value_t* out_result);
1183 
1184  spacewasm_hostcall_result_t wasmPanic(struct spacewasm_caller_t* caller,
1185  const struct spacewasm_value_t* params,
1186  size_t n_params,
1187  struct spacewasm_value_t* out_result);
1188 
1189  spacewasm_hostcall_result_t wasmArgs(struct spacewasm_caller_t* caller,
1190  const struct spacewasm_value_t* params,
1191  size_t n_params,
1192  struct spacewasm_value_t* out_result);
1193 
1194  spacewasm_hostcall_result_t wasmTime(struct spacewasm_caller_t* caller,
1195  const struct spacewasm_value_t* params,
1196  size_t n_params,
1197  struct spacewasm_value_t* out_result);
1198 
1199  spacewasm_hostcall_result_t wasmReadTelemetry(struct spacewasm_caller_t* caller,
1200  const struct spacewasm_value_t* params,
1201  size_t n_params,
1202  struct spacewasm_value_t* out_result);
1203 
1204  spacewasm_hostcall_result_t wasmReadParameter(struct spacewasm_caller_t* caller,
1205  const struct spacewasm_value_t* params,
1206  size_t n_params,
1207  struct spacewasm_value_t* out_result);
1208 
1209  spacewasm_hostcall_result_t wasmCommand(struct spacewasm_caller_t* caller,
1210  const struct spacewasm_value_t* params,
1211  size_t n_params,
1212  struct spacewasm_value_t* out_result);
1213 
1214  spacewasm_hostcall_result_t wasmEvent(struct spacewasm_caller_t* caller,
1215  const struct spacewasm_value_t* params,
1216  size_t n_params,
1217  struct spacewasm_value_t* out_result);
1218 
1219  spacewasm_hostcall_result_t wasmRsleep(struct spacewasm_caller_t* caller,
1220  const struct spacewasm_value_t* params,
1221  size_t n_params,
1222  struct spacewasm_value_t* out_result);
1223 
1224  spacewasm_hostcall_result_t wasmAsleep(struct spacewasm_caller_t* caller,
1225  const struct spacewasm_value_t* params,
1226  size_t n_params,
1227  struct spacewasm_value_t* out_result);
1228 
1229  spacewasm_hostcall_result_t wasmSerialOut(struct spacewasm_caller_t* caller,
1230  const struct spacewasm_value_t* params,
1231  size_t n_params,
1232  struct spacewasm_value_t* out_result);
1233 
1234  spacewasm_hostcall_result_t wasmSerialRecv(struct spacewasm_caller_t* caller,
1235  const struct spacewasm_value_t* params,
1236  size_t n_params,
1237  struct spacewasm_value_t* out_result);
1238 
1240  void dispatchCommand();
1241 
1243  void dispatchTelemetry();
1244 
1246  void dispatchParameter();
1247 
1249  void dispatchEvent();
1250 
1252  void dispatchRelativeSleep();
1253 
1255  void dispatchAbsoluteSleep();
1256 
1258  void dispatchTime();
1259 
1261  void dispatchSerialOut();
1262 
1264  void dispatchSerialRecv();
1265 
1266  // A global static lock. This is needed to allow the global allocator in spacewasm
1267  // to not require to pass context to fine grained context to allocations.
1268  // Read more about this in the SDD.
1269  static Os::Mutex* getGlobalAllocatorLock();
1270 };
1271 
1272 } // namespace Svc
1273 
1274 #endif
struct Svc::WasmSequencer::PendingHostFunction::Args::@791 telemetry
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
Auto-generated base for WasmSequencer component.
constexpr FwSizeType SPACEWASM_PAGE_SIZE
U8 maxGuestModules
Maximum number of Wasm modules that may be loaded into the sequencer&#39;s store.
FwIdType FwPrmIdType
The type of a parameter identifier.
Link-time delegating Mutex implementation.
struct Svc::WasmSequencer::PendingHostFunction::Args::@794 rsleep
WasmSequencer(const char *const compName)
Construct WasmSequencer object.
struct spacewasm_caller_t spacewasm_caller_t
Definition: spacewasm.h:369
SerialInQueueFullBehavior
Configuration to select what happens when a serialIn fills.
Enum representing a command response.
void deinit() override
Tear down the allocations made by configure()
~WasmSequencer()=default
Destroy WasmSequencer object.
WasmSequencer & operator=(const WasmSequencer &)=delete
T
The raw enum type.
static constexpr FwSizeType SPACEWASM_MEMORY_ALIGNMENT
SpaceWasm has a hard-coded memory alignment requirement.
struct Svc::WasmSequencer::PendingHostFunction::Args::@792 parameter
float F32
32-bit floating point
Definition: BasicTypes.h:84
struct Svc::WasmSequencer::PendingHostFunction::Args::@798 serialRecv
spacewasm_trap_t
Definition: spacewasm.h:266
SerialInQueueFullBehavior fullBehavior
Overflow policy applied when a new frame does not fit.
Per-port serialIn queue configuration.
struct Svc::WasmSequencer::PendingHostFunction::Args::@795 asleep
SerialInQueueConfig serialIn[NUM_SERIALIN_INPUT_PORTS]
void configure(const Config &cfg, Fw::MemAllocator &mallocator)
External serialize buffer with no copy semantics.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
Sequencer blocking state.
struct Svc::WasmSequencer::PendingHostFunction::Args::@797 serialOut
spacewasm_hostcall_result_t
Definition: spacewasm.h:160
struct Svc::WasmSequencer::PendingHostFunction::Args::@796 time
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Trigger an assertion if the queue fills and cannot process another message.
Per-kind call arguments. Only the arm matching kind is live.
Drop the latest message if it cannot fit in the remaining queue space.
struct spacewasm_t spacewasm_t
Definition: spacewasm.h:361
Memory Allocation base class.
spacewasm_status_t
Definition: spacewasm.h:37
friend class WasmSequencerTester
PlatformIndexType FwIndexType
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
Definition: BasicTypes.h:86
struct Svc::WasmSequencer::PendingHostFunction::Args::@793 event
Fw::MallocAllocator mallocator
Definition: RefTopology.cpp:23
struct Svc::WasmSequencer::PendingHostFunction::Args::@790 command
RateGroupDivider component implementation.
Defines a base class for a memory allocator for classes.
Declares F Prime string base class.
A struct holding the context needed to reply to a command request.
static constexpr FwSizeType SPACEWASM_IR_PAGE_SIZE
struct spacewasm_allocator_t spacewasm_allocator_t
Definition: spacewasm.h:355
Success/Failure.
FwSizeType size
Queue size in bytes. A port left at size 0 gets no queue (all inbound frames on that index are droppe...
We did not explicitely set the exit reason, bug?