7 #ifndef Svc_WasmSequencer_HPP 8 #define Svc_WasmSequencer_HPP 30 #include "config/WasmSequencerConfig.hpp" 70 "SpaceWasm does not support dynamic memory pages smaller than a single IR page (512 bytes)");
179 void writeTelemetryInternal_internalInterfaceHandler()
override;
182 void writeTelemetryInternal_overflowHook()
override;
338 void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
347 void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
355 void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
364 void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
373 void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
383 void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
392 void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
401 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
411 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
422 void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
432 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
442 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
452 void Svc_WasmSequencer_ControllerStateMachine_action_load(
461 void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
470 void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
479 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
488 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
498 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
507 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
516 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
525 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
534 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
543 void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
552 void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
561 void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
570 void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
578 void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
586 void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
592 void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
599 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
606 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
612 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
618 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
625 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
632 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
638 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
644 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
651 void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
658 void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
667 void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
675 void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
683 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
691 void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
699 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
707 void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
716 void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
724 void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
732 void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
741 void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
749 void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
757 void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
771 bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
779 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
788 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
797 bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
806 bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
814 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
822 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
830 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
838 bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
847 bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
854 U8* globalAlloc(U32 size, U32 align);
855 void globalDealloc(
const U8* ptr);
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);
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);
879 void takeAllocatorLock();
882 void releaseAllocatorLock();
953 WaitingCmd() : opCode(0), cmdSeq(0) {}
954 WaitingCmd(
FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
963 WasmSequencer_RequestContext m_executingContext;
964 bool m_hasExecutingContext;
968 bool m_hasPendingTimer;
974 bool m_hasHostFunctionStart;
976 bool m_dequeueSucceeded;
985 bool m_cancelRequested;
991 U64 sequencesSucceeded{0};
994 U64 sequencesFailed{0};
997 U64 sequencesCancelled{0};
1000 U64 commandsDispatched{0};
1003 U64 commandsFailed{0};
1012 std::atomic<bool> m_writeTelemetryQueued;
1018 U32 m_sequencesStarted;
1024 U32 makeCmdUid()
const;
1059 struct PendingHostFunction {
1060 PendingHostFunction() =
default;
1136 PendingHostFunction m_pendingHostFunction;
1240 void dispatchCommand();
1243 void dispatchTelemetry();
1246 void dispatchParameter();
1249 void dispatchEvent();
1252 void dispatchRelativeSleep();
1255 void dispatchAbsoluteSleep();
1258 void dispatchTime();
1261 void dispatchSerialOut();
1264 void dispatchSerialRecv();
1269 static Os::Mutex* getGlobalAllocatorLock();
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'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
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
static constexpr FwSizeType SPACEWASM_MEMORY_ALIGNMENT
SpaceWasm has a hard-coded memory alignment requirement.
struct Svc::WasmSequencer::PendingHostFunction::Args::@792 parameter
Svc::BlockState::T blockingType
FwSizeType guestMemorySize
float F32
32-bit floating point
struct Svc::WasmSequencer::PendingHostFunction::Args::@798 serialRecv
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.
U8 WasmSequencer_ModuleIdx
struct Svc::WasmSequencer::PendingHostFunction::Args::@797 serialOut
spacewasm_hostcall_result_t
struct Svc::WasmSequencer::PendingHostFunction::Args::@796 time
uint8_t U8
8-bit unsigned integer
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
Memory Allocation base class.
SmId
State machine identifiers.
friend class WasmSequencerTester
PlatformIndexType FwIndexType
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
struct Svc::WasmSequencer::PendingHostFunction::Args::@793 event
Fw::MallocAllocator mallocator
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
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?