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 
15 #include "Fw/Types/StringBase.hpp"
28 #include "config/WasmSequencerConfig.hpp"
29 
30 namespace Svc {
31 
33  friend class WasmSequencerTester;
34 
35  public:
36  // ----------------------------------------------------------------------
37  // Component construction and destruction
38  // ----------------------------------------------------------------------
39 
41  WasmSequencer(const char* const compName
42  );
43 
45  ~WasmSequencer() = default;
46 
49  WasmSequencer(const WasmSequencer&) = delete;
50  WasmSequencer& operator=(const WasmSequencer&) = delete;
51 
54  DROP_NEWEST,
55  DROP_OLDEST,
56  ASSERT,
58  };
59 
61  constexpr static FwSizeType SPACEWASM_MEMORY_ALIGNMENT = 8;
62 
66  constexpr static FwSizeType SPACEWASM_IR_PAGE_SIZE = 512;
68  "SpaceWasm does not support dynamic memory pages smaller than a single IR page (512 bytes)");
69 
76  };
77 
80  struct Config {
86 
91 
98 
111 
114 
119 
125  };
126 
129  void configure(const Config& cfg, Fw::MemAllocator& mallocator);
130 
132  void deinit() override;
133 
134  private:
135  // ----------------------------------------------------------------------
136  // Handler implementations for typed input ports
137  // ----------------------------------------------------------------------
138 
142  void checkTimers_handler(FwIndexType portNum,
143  U32 context
144  ) override;
145 
149  void cmdResponseIn_handler(FwIndexType portNum,
150  FwOpcodeType opCode,
151  U32 cmdSeq,
152  const Fw::CmdResponse& response
153  ) override;
154 
158  void seqCancelIn_handler(FwIndexType portNum
159  ) override;
160 
164  void seqRunIn_handler(FwIndexType portNum,
165  const Fw::StringBase& filename,
166  const Svc::SeqArgs& args
167  ) override;
168 
172  void writeTelemetry_handler(FwIndexType portNum,
173  U32 context
174  ) override;
175 
176  private:
177  // ----------------------------------------------------------------------
178  // Handler implementations for serial input ports
179  // ----------------------------------------------------------------------
180 
186  void serialIn_handler(FwIndexType portNum,
187  Fw::LinearBufferBase& buffer
188  ) override;
189 
190  private:
191  // ----------------------------------------------------------------------
192  // Handler implementations for commands
193  // ----------------------------------------------------------------------
194 
208  void RUN_cmdHandler(
209  FwOpcodeType opCode,
210  U32 cmdSeq,
211  const Fw::CmdStringArg& fileName,
212  const Svc::BlockState& block,
213  const Svc::SeqArgs& seqArgs
214  ) override;
216 
223  void LOAD_cmdHandler(FwOpcodeType opCode,
224  U32 cmdSeq,
225  const Fw::CmdStringArg& fileName,
226  const Fw::CmdStringArg& name
227  ) override;
228 
232  void INVOKE_cmdHandler(FwOpcodeType opCode,
233  U32 cmdSeq,
234  const Fw::CmdStringArg& module,
235  const Svc::BlockState& block,
236  const Svc::SeqArgs& seqArgs
237  ) override;
238 
242  void WAIT_cmdHandler(FwOpcodeType opCode,
243  U32 cmdSeq
244  ) override;
245 
250  void CANCEL_cmdHandler(FwOpcodeType opCode,
251  U32 cmdSeq
252  ) override;
253 
261  void PAUSE_cmdHandler(FwOpcodeType opCode,
262  U32 cmdSeq
263  ) override;
264 
268  void CONTINUE_cmdHandler(FwOpcodeType opCode,
269  U32 cmdSeq
270  ) override;
271 
276  void GLOBAL_SET_I32_cmdHandler(FwOpcodeType opCode,
277  U32 cmdSeq,
278  const Fw::CmdStringArg& moduleName,
279  const Fw::CmdStringArg& name,
280  I32 value
281  ) override;
282 
287  void GLOBAL_SET_I64_cmdHandler(FwOpcodeType opCode,
288  U32 cmdSeq,
289  const Fw::CmdStringArg& moduleName,
290  const Fw::CmdStringArg& name,
291  I64 value
292  ) override;
293 
298  void GLOBAL_SET_F32_cmdHandler(FwOpcodeType opCode,
299  U32 cmdSeq,
300  const Fw::CmdStringArg& moduleName,
301  const Fw::CmdStringArg& name,
302  F32 value
303  ) override;
304 
309  void GLOBAL_SET_F64_cmdHandler(FwOpcodeType opCode,
310  U32 cmdSeq,
311  const Fw::CmdStringArg& moduleName,
312  const Fw::CmdStringArg& name,
313  F64 value
314  ) override;
315 
320  void GLOBAL_GET_cmdHandler(FwOpcodeType opCode,
321  U32 cmdSeq,
322  const Fw::CmdStringArg& moduleName,
323  const Fw::CmdStringArg& name
324  ) override;
325 
326  private:
327  // ----------------------------------------------------------------------
328  // Implementations for internal state machine actions
329  // ----------------------------------------------------------------------
330 
334  void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
335  SmId smId,
338  ) override;
339 
343  void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
344  SmId smId,
346  ) override;
347 
351  void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
352  SmId smId,
354  ) override;
355 
359  void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
360  SmId smId,
363  ) override;
364 
368  void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
369  SmId smId,
372  ) override;
373 
377  void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
378  SmId smId,
381  ) override;
382 
386  void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
387  SmId smId,
389  ) override;
390 
395  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
396  SmId smId,
399  ) override;
400 
405  void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
406  SmId smId,
409  ) override;
410 
415  void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
416  SmId smId,
418  const Svc::WasmSequencer_LoadRequest& value
419  ) override;
420 
425  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
426  SmId smId,
429  ) override;
430 
435  void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
436  SmId smId,
439  ) override;
440 
445  void Svc_WasmSequencer_ControllerStateMachine_action_load(
446  SmId smId,
448  const Svc::WasmSequencer_LoadRequest& value
449  ) override;
450 
454  void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
455  SmId smId,
458  ) override;
459 
463  void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
464  SmId smId,
467  ) override;
468 
472  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
473  SmId smId,
476  ) override;
477 
481  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
482  SmId smId,
485  ) override;
486 
491  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
492  SmId smId,
495  ) override;
496 
500  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
501  SmId smId,
504  ) override;
505 
509  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
510  SmId smId,
513  ) override;
514 
518  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
519  SmId smId,
522  ) override;
523 
527  void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
528  SmId smId,
531  ) override;
532 
536  void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
537  SmId smId,
539  ) override;
540 
545  void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
546  SmId smId,
549  ) override;
550 
554  void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
555  SmId smId,
558  ) override;
559 
563  void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
564  SmId smId,
566  ) override;
567 
571  void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
572  SmId smId,
574  ) override;
575 
579  void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
580  SmId smId,
582  ) override;
583 
585  void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
586  SmId smId,
588  ) override;
589 
592  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
593  SmId smId,
595  ) override;
596 
599  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
600  SmId smId,
602  ) override;
603 
605  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
606  SmId smId,
608  ) override;
609 
611  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
612  SmId smId,
614  ) override;
615 
618  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
619  SmId smId,
621  ) override;
622 
625  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
626  SmId smId,
628  ) override;
629 
631  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
632  SmId smId,
634  ) override;
635 
637  void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
638  SmId smId,
640  I32 value
641  ) override;
642 
644  void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
645  SmId smId,
647  const Svc::WasmSequencer_TrapReason& value
648  ) override;
649 
651  void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
652  SmId smId,
654  ) override;
655 
660  void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
661  SmId smId,
663  ) override;
664 
668  void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
669  SmId smId,
671  ) override;
672 
676  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
677  SmId smId,
679  ) override;
680 
684  void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
685  SmId smId,
687  ) override;
688 
692  void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
693  SmId smId,
695  ) override;
696 
700  void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
701  SmId smId,
704  ) override;
705 
709  void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
710  SmId smId,
712  ) override;
713 
717  void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
718  SmId smId,
720  ) override;
721 
725  void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
726  SmId smId,
728  I32 value
729  ) override;
730 
734  void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
735  SmId smId,
737  ) override;
738 
742  void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
743  SmId smId,
745  ) override;
746 
750  void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
751  SmId smId,
753  const FwIndexType& value
754  ) override;
755 
756  private:
757  // ----------------------------------------------------------------------
758  // Implementations for internal state machine guards
759  // ----------------------------------------------------------------------
760 
764  bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
765  SmId smId,
767  ) const override;
768 
772  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
773  SmId smId,
776  ) const override;
777 
781  bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
782  SmId smId,
785  ) const override;
786 
790  bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
791  SmId smId,
794  ) const override;
795 
799  bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
800  SmId smId,
802  ) const override;
803 
807  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
808  SmId smId,
810  ) const override;
811 
815  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
816  SmId smId,
818  ) const override;
819 
823  bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
824  SmId smId,
826  ) const override;
827 
831  bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
832  SmId smId,
834  const FwIndexType& value
835  ) const override;
836 
840  bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
841  SmId smId,
843  ) const override;
844 
845  private:
847  U8* globalAlloc(U32 size, U32 align);
848  void globalDealloc(const U8* ptr);
849 
851  static U8* globalAllocCallback(void* userdata, size_t size, size_t align);
852  static void globalDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
853 
855  U8* guestAlloc(FwSizeType size, U32 align);
856  U8* guestRealloc(U8* ptr, FwSizeType oldSize, FwSizeType newSize, U32 align);
857  void guestDealloc(const U8* ptr, FwSizeType size);
858 
859  // Guest allocator callbacks passed to C API
860  static U8* guestAllocCallback(void* userdata, size_t size, size_t align);
861  static U8* guestReallocCallback(void* userdata, U8* ptr, size_t old_size, size_t new_size, size_t align);
862  static void guestDeallocCallback(void* userdata, U8* ptr, size_t size, size_t align);
863 
866  void createStore();
867 
869  void destroyStore();
870 
872  void takeAllocatorLock();
873 
875  void releaseAllocatorLock();
876 
878  static Svc::WasmSequencer_TrapReason::T mapTrapReason(spacewasm_trap_t trap);
879 
883  void setSequenceName(const Fw::StringBase& filePath, const Fw::StringBase& moduleName);
884 
888  static const char* pathBaseName(const char* path, FwSizeType len, FwSizeType& outLen);
889 
893  static bool pathHasParentTraversal(const Fw::StringBase& path);
894 
899  bool resolveSequencePath(const Fw::StringBase& fileName, Fw::String& filePath);
900 
903  Fw::Success readGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, U8* dst, FwSizeType len);
904 
907  Fw::Success writeGuestMemory(WasmSequencer_HostFunction::T kind, U32 addr, const U8* src, FwSizeType len);
908 
909  Fw::MemAllocator* m_allocator = nullptr;
910 
912  Config m_config;
913 
917  U8** m_heapPages;
918 
920  FwSizeType m_heapPagesUsed;
921 
925  bool m_heapPoisoned;
926 
929  U8* m_guestPool;
930 
932  FwSizeType m_guestPoolOffset;
933 
935  spacewasm_t* m_wasm;
936 
938  spacewasm_allocator_t* m_guest_allocator;
939 
941  struct WaitingCmd {
942  FwOpcodeType opCode;
943  U32 cmdSeq;
944 
945  WaitingCmd() : opCode(0), cmdSeq(0) {}
946  WaitingCmd(FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
947  };
948 
951 
953  Svc::SeqArgs m_args;
954 
956  Fw::FileNameString m_lastLoadFileName;
957 
958  WasmSequencer_RequestContext m_executingContext;
959  bool m_hasExecutingContext;
960 
962  Fw::Time m_pendingTimer;
963  bool m_hasPendingTimer;
964 
968  Fw::Time m_hostFunctionStart;
969  bool m_hasHostFunctionStart;
970 
971  bool m_dequeueSucceeded;
972 
974  spacewasm_status_t m_invokeStatus;
975 
977  bool m_pendingPause;
978 
980  bool m_cancelRequested;
981 
984  struct Telemetry {
986  U64 sequencesSucceeded{0};
987 
989  U64 sequencesFailed{0};
990 
992  U64 sequencesCancelled{0};
993 
995  U64 commandsDispatched{0};
996 
998  U64 commandsFailed{0};
999 
1001  Fw::FileNameString sequenceName{""};
1002  };
1003 
1004  Telemetry m_tlm;
1005 
1010  U32 m_sequencesStarted;
1011 
1016  U32 makeCmdUid() const;
1017 
1020  struct ExitStatus {
1023  WasmSequencer_ExitReason reason{WasmSequencer_ExitReason::UNKNOWN};
1024 
1026  I32 code{0};
1027 
1029  WasmSequencer_HostFunction lastHostFunction{WasmSequencer_HostFunction::NONE};
1030 
1032  WasmSequencer_TrapReason lastTrapReason{WasmSequencer_TrapReason::NONE};
1033  };
1034 
1036  ExitStatus m_exit;
1037 
1039  Fw::ExternalSerializeBuffer m_serialOutBuffer;
1040 
1044 
1046  Os::Mutex m_serialInMutex;
1047 
1051  struct PendingHostFunction {
1052  PendingHostFunction() = default;
1053  bool isPending() const { return kind != WasmSequencer_HostFunction::NONE; }
1054  void clear() { kind = WasmSequencer_HostFunction::NONE; }
1055 
1056  WasmSequencer_HostFunction kind{WasmSequencer_HostFunction::NONE};
1057 
1058  // Handle that holds the Wasm guest memory pointer
1059  spacewasm_caller_t* caller{nullptr};
1060 
1062  union Args {
1063  // COMMAND: encoded command payload in guest memory
1064  struct {
1065  U32 ptr;
1066  U32 len;
1067  } command;
1068 
1069  // TELEMETRY: channel id plus where to write the serialized time and value
1070  struct {
1072  U32 timePtr;
1073  U32 timeLen;
1076  } telemetry;
1077 
1078  // PARAMETER: parameter id plus where to write the serialized value
1079  struct {
1081  U32 ptr;
1082  U32 len;
1083  } parameter;
1084 
1085  // EVENT: raw guest-requested severity (may be out of range) plus the message
1086  struct {
1088  U32 msgPtr;
1089  U32 msgLen;
1090  } event;
1091 
1092  // RSLEEP: relative sleep duration
1093  struct {
1094  U64 us;
1095  } rsleep;
1096 
1097  // ASLEEP: absolute sleep time
1098  struct {
1099  U64 us;
1100  } asleep;
1101 
1102  // ARGS: where to write the stored sequence arguments
1103  struct {
1104  U32 ptr;
1105  U32 len;
1106  } args;
1107 
1108  // TIME: where to write the serialized current time
1109  struct {
1110  U32 ptr;
1111  U32 len;
1112  } time;
1113 
1114  // SERIAL_OUT: serial output port index plus payload in guest memory
1115  struct {
1116  U32 index;
1117  U32 ptr;
1118  U32 len;
1119  } serialOut;
1120 
1121  // SERIAL_RECV: Read a message from the serialIn port queue given a port index
1122  struct {
1123  U32 index;
1124  U32 dataPtr;
1128  } serialRecv;
1129 
1130  Args() : command{0, 0} {}
1131  } u;
1132  };
1133 
1134  PendingHostFunction m_pendingHostFunction;
1135 
1137  spacewasm_status_t validateModuleMain(WasmSequencer_ModuleIdx moduleIdx) const;
1138 
1144  void reportSequenceRuntimeFailure(WasmSequencer_ModuleIdx moduleIdx, WasmSequencer_SequencePhase phase);
1145 
1147  void respondToRequest(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1148 
1150  void respondToWaiting(const Fw::CmdResponse& response);
1151 
1158  void reportSeqDone(const Svc::WasmSequencer_RequestContext& value, const Fw::CmdResponse& response);
1159 
1161  spacewasm_status_t setGlobal(const Fw::StringBase& moduleName, const Fw::StringBase& name, spacewasm_value_t value);
1162 
1164  spacewasm_status_t getGlobal(const Fw::StringBase& moduleName,
1165  const Fw::StringBase& name,
1166  spacewasm_value_t& value);
1167 
1169  void hostFprimeV1(spacewasm_host_t*);
1170 
1172  spacewasm_hostcall_result_t wasmExit(struct spacewasm_caller_t* caller,
1173  const struct spacewasm_value_t* params,
1174  size_t n_params,
1175  struct spacewasm_value_t* out_result);
1176 
1177  spacewasm_hostcall_result_t wasmPanic(struct spacewasm_caller_t* caller,
1178  const struct spacewasm_value_t* params,
1179  size_t n_params,
1180  struct spacewasm_value_t* out_result);
1181 
1182  spacewasm_hostcall_result_t wasmArgs(struct spacewasm_caller_t* caller,
1183  const struct spacewasm_value_t* params,
1184  size_t n_params,
1185  struct spacewasm_value_t* out_result);
1186 
1187  spacewasm_hostcall_result_t wasmTime(struct spacewasm_caller_t* caller,
1188  const struct spacewasm_value_t* params,
1189  size_t n_params,
1190  struct spacewasm_value_t* out_result);
1191 
1192  spacewasm_hostcall_result_t wasmReadTelemetry(struct spacewasm_caller_t* caller,
1193  const struct spacewasm_value_t* params,
1194  size_t n_params,
1195  struct spacewasm_value_t* out_result);
1196 
1197  spacewasm_hostcall_result_t wasmReadParameter(struct spacewasm_caller_t* caller,
1198  const struct spacewasm_value_t* params,
1199  size_t n_params,
1200  struct spacewasm_value_t* out_result);
1201 
1202  spacewasm_hostcall_result_t wasmCommand(struct spacewasm_caller_t* caller,
1203  const struct spacewasm_value_t* params,
1204  size_t n_params,
1205  struct spacewasm_value_t* out_result);
1206 
1207  spacewasm_hostcall_result_t wasmEvent(struct spacewasm_caller_t* caller,
1208  const struct spacewasm_value_t* params,
1209  size_t n_params,
1210  struct spacewasm_value_t* out_result);
1211 
1212  spacewasm_hostcall_result_t wasmRsleep(struct spacewasm_caller_t* caller,
1213  const struct spacewasm_value_t* params,
1214  size_t n_params,
1215  struct spacewasm_value_t* out_result);
1216 
1217  spacewasm_hostcall_result_t wasmAsleep(struct spacewasm_caller_t* caller,
1218  const struct spacewasm_value_t* params,
1219  size_t n_params,
1220  struct spacewasm_value_t* out_result);
1221 
1222  spacewasm_hostcall_result_t wasmSerialOut(struct spacewasm_caller_t* caller,
1223  const struct spacewasm_value_t* params,
1224  size_t n_params,
1225  struct spacewasm_value_t* out_result);
1226 
1227  spacewasm_hostcall_result_t wasmSerialRecv(struct spacewasm_caller_t* caller,
1228  const struct spacewasm_value_t* params,
1229  size_t n_params,
1230  struct spacewasm_value_t* out_result);
1231 
1233  void dispatchCommand();
1234 
1236  void dispatchTelemetry();
1237 
1239  void dispatchParameter();
1240 
1242  void dispatchEvent();
1243 
1245  void dispatchRelativeSleep();
1246 
1248  void dispatchAbsoluteSleep();
1249 
1251  void dispatchArgs();
1252 
1254  void dispatchTime();
1255 
1257  void dispatchSerialOut();
1258 
1260  void dispatchSerialRecv();
1261 
1262  // A global static lock. This is needed to allow the global allocator in spacewasm
1263  // to not require to pass context to fine grained context to allocations.
1264  // Read more about this in the SDD.
1265  static Os::Mutex* getGlobalAllocatorLock();
1266 };
1267 
1268 } // namespace Svc
1269 
1270 #endif
struct Svc::WasmSequencer::PendingHostFunction::Args::@759 rsleep
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's store.
FwIdType FwPrmIdType
The type of a parameter identifier.
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.
float F32
32-bit floating point
Definition: BasicTypes.h:84
spacewasm_trap_t
Definition: spacewasm.h:266
struct Svc::WasmSequencer::PendingHostFunction::Args::@755 command
SerialInQueueFullBehavior fullBehavior
Overflow policy applied when a new frame does not fit.
Per-port serialIn queue configuration.
struct Svc::WasmSequencer::PendingHostFunction::Args::@760 asleep
struct Svc::WasmSequencer::PendingHostFunction::Args::@764 serialRecv
SerialInQueueConfig serialIn[NUM_SERIALIN_INPUT_PORTS]
void configure(const Config &cfg, Fw::MemAllocator &mallocator)
struct Svc::WasmSequencer::PendingHostFunction::Args::@761 args
External serialize buffer with no copy semantics.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
Sequencer blocking state.
spacewasm_hostcall_result_t
Definition: spacewasm.h:160
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
struct Svc::WasmSequencer::PendingHostFunction::Args::@758 event
friend class WasmSequencerTester
struct Svc::WasmSequencer::PendingHostFunction::Args::@762 time
PlatformIndexType FwIndexType
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
Definition: BasicTypes.h:86
Fw::MallocAllocator mallocator
Definition: RefTopology.cpp:23
RateGroupDivider component implementation.
Defines a base class for a memory allocator for classes.
Declares F Prime string base class.
struct Svc::WasmSequencer::PendingHostFunction::Args::@763 serialOut
struct Svc::WasmSequencer::PendingHostFunction::Args::@756 telemetry
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?
struct Svc::WasmSequencer::PendingHostFunction::Args::@757 parameter