7 #ifndef Svc_WasmSequencer_HPP 8 #define Svc_WasmSequencer_HPP 28 #include "config/WasmSequencerConfig.hpp" 68 "SpaceWasm does not support dynamic memory pages smaller than a single IR page (512 bytes)");
334 void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
343 void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
351 void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
359 void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
368 void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
377 void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
386 void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
395 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
405 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
415 void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
425 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
435 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
445 void Svc_WasmSequencer_ControllerStateMachine_action_load(
454 void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
463 void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
472 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
481 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
491 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
500 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
509 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
518 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
527 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
536 void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
545 void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
554 void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
563 void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
571 void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
579 void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
585 void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
592 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
599 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
605 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
611 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
618 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
625 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
631 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
637 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
644 void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
651 void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
660 void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
668 void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
676 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
684 void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
692 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
700 void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
709 void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
717 void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
725 void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
734 void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
742 void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
750 void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
764 bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
772 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
781 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
790 bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
799 bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
807 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
815 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
823 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
831 bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
840 bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
847 U8* globalAlloc(U32 size, U32 align);
848 void globalDealloc(
const U8* ptr);
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);
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);
872 void takeAllocatorLock();
875 void releaseAllocatorLock();
945 WaitingCmd() : opCode(0), cmdSeq(0) {}
946 WaitingCmd(
FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
958 WasmSequencer_RequestContext m_executingContext;
959 bool m_hasExecutingContext;
963 bool m_hasPendingTimer;
969 bool m_hasHostFunctionStart;
971 bool m_dequeueSucceeded;
980 bool m_cancelRequested;
986 U64 sequencesSucceeded{0};
989 U64 sequencesFailed{0};
992 U64 sequencesCancelled{0};
995 U64 commandsDispatched{0};
998 U64 commandsFailed{0};
1010 U32 m_sequencesStarted;
1016 U32 makeCmdUid()
const;
1051 struct PendingHostFunction {
1052 PendingHostFunction() =
default;
1134 PendingHostFunction m_pendingHostFunction;
1233 void dispatchCommand();
1236 void dispatchTelemetry();
1239 void dispatchParameter();
1242 void dispatchEvent();
1245 void dispatchRelativeSleep();
1248 void dispatchAbsoluteSleep();
1251 void dispatchArgs();
1254 void dispatchTime();
1257 void dispatchSerialOut();
1260 void dispatchSerialRecv();
1265 static Os::Mutex* getGlobalAllocatorLock();
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
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.
Svc::BlockState::T blockingType
FwSizeType guestMemorySize
float F32
32-bit floating point
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.
U8 WasmSequencer_ModuleIdx
spacewasm_hostcall_result_t
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.
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.
Fw::MallocAllocator mallocator
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
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