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)");
330 void Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
339 void Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
347 void Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
356 void Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
365 void Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
375 void Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
384 void Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
393 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
403 void Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
414 void Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
424 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
434 void Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
444 void Svc_WasmSequencer_ControllerStateMachine_action_load(
453 void Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
462 void Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
471 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
480 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
490 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
499 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
508 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
517 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
526 void Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
535 void Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
544 void Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
553 void Svc_WasmSequencer_InterpreterStateMachine_action_cmdReplyOK(
562 void Svc_WasmSequencer_InterpreterStateMachine_action_signalEntered(
570 void Svc_WasmSequencer_InterpreterStateMachine_action_spin(
578 void Svc_WasmSequencer_InterpreterStateMachine_action_reset(
584 void Svc_WasmSequencer_InterpreterStateMachine_action_clearExitStatus(
591 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_FINISHED(
598 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_INTERPRETER_TRAP(
604 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_REPLY_TIMEOUT(
610 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_HOST_FAILURE(
617 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_TIMER_INCOMPARABLE(
624 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_UNEXPECTED_REPLY(
630 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitReason_CANCEL(
636 void Svc_WasmSequencer_InterpreterStateMachine_action_setExitCode(
643 void Svc_WasmSequencer_InterpreterStateMachine_action_setTrapReason(
650 void Svc_WasmSequencer_InterpreterStateMachine_action_setLastHostFunction(
659 void Svc_WasmSequencer_InterpreterStateMachine_action_finish(
667 void Svc_WasmSequencer_InterpreterStateMachine_action_reportPaused(
675 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPause(
683 void Svc_WasmSequencer_InterpreterStateMachine_action_dispatchPendingHostFunction(
691 void Svc_WasmSequencer_InterpreterStateMachine_action_clearPendingHostFunction(
699 void Svc_WasmSequencer_InterpreterStateMachine_action_setContext(
708 void Svc_WasmSequencer_InterpreterStateMachine_action_clearContext(
716 void Svc_WasmSequencer_InterpreterStateMachine_action_resume(
724 void Svc_WasmSequencer_InterpreterStateMachine_action_resumeI32(
733 void Svc_WasmSequencer_InterpreterStateMachine_action_checkSleepTimers(
741 void Svc_WasmSequencer_InterpreterStateMachine_action_checkTimeout(
749 void Svc_WasmSequencer_InterpreterStateMachine_action_dequeueSerialAndResume(
763 bool Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
771 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
780 bool Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
789 bool Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
798 bool Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
806 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingPause(
814 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunction(
822 bool Svc_WasmSequencer_InterpreterStateMachine_guard_pendingHostFunctionIsSleep(
830 bool Svc_WasmSequencer_InterpreterStateMachine_guard_blockingSerialIn(
839 bool Svc_WasmSequencer_InterpreterStateMachine_guard_dequeueSucceeded(
846 U8* globalAlloc(U32 size, U32 align);
847 void globalDealloc(
const U8* ptr);
850 static U8* globalAllocCallback(
void* userdata,
size_t size,
size_t align);
851 static void globalDeallocCallback(
void* userdata,
U8* ptr,
size_t size,
size_t align);
859 static U8* guestAllocCallback(
void* userdata,
size_t size,
size_t align);
860 static U8* guestReallocCallback(
void* userdata,
U8* ptr,
size_t old_size,
size_t new_size,
size_t align);
861 static void guestDeallocCallback(
void* userdata,
U8* ptr,
size_t size,
size_t align);
871 void takeAllocatorLock();
874 void releaseAllocatorLock();
945 WaitingCmd() : opCode(0), cmdSeq(0) {}
946 WaitingCmd(
FwOpcodeType opCode_, U32 cmdSeq_) : opCode(opCode_), cmdSeq(cmdSeq_) {}
955 WasmSequencer_RequestContext m_executingContext;
956 bool m_hasExecutingContext;
960 bool m_hasPendingTimer;
966 bool m_hasHostFunctionStart;
968 bool m_dequeueSucceeded;
977 bool m_cancelRequested;
983 U64 sequencesSucceeded{0};
986 U64 sequencesFailed{0};
989 U64 sequencesCancelled{0};
992 U64 commandsDispatched{0};
995 U64 commandsFailed{0};
1007 U32 m_sequencesStarted;
1013 U32 makeCmdUid()
const;
1048 struct PendingHostFunction {
1049 PendingHostFunction() =
default;
1125 PendingHostFunction m_pendingHostFunction;
1229 void dispatchCommand();
1232 void dispatchTelemetry();
1235 void dispatchParameter();
1238 void dispatchEvent();
1241 void dispatchRelativeSleep();
1244 void dispatchAbsoluteSleep();
1247 void dispatchTime();
1250 void dispatchSerialOut();
1253 void dispatchSerialRecv();
1258 static Os::Mutex* getGlobalAllocatorLock();
struct Svc::WasmSequencer::PendingHostFunction::Args::@775 asleep
struct Svc::WasmSequencer::PendingHostFunction::Args::@774 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.
Link-time delegating Mutex implementation.
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
struct Svc::WasmSequencer::PendingHostFunction::Args::@772 parameter
struct Svc::WasmSequencer::PendingHostFunction::Args::@778 serialRecv
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
SerialInQueueFullBehavior fullBehavior
Overflow policy applied when a new frame does not fit.
Per-port serialIn queue configuration.
struct Svc::WasmSequencer::PendingHostFunction::Args::@773 event
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::@771 telemetry
U8 WasmSequencer_ModuleIdx
struct Svc::WasmSequencer::PendingHostFunction::Args::@770 command
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.
friend class WasmSequencerTester
PlatformIndexType FwIndexType
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
Fw::MallocAllocator mallocator
struct Svc::WasmSequencer::PendingHostFunction::Args::@777 serialOut
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 Svc::WasmSequencer::PendingHostFunction::Args::@776 time
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?