24 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
39 context.
set_moduleIdx(static_cast<WasmSequencer_ModuleIdx>(moduleIdx));
44 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
55 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
68 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
71 this->m_tlm.sequencesFailed++;
74 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
77 this->m_cancelRequested =
true;
80 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
83 this->m_cancelRequested =
false;
86 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
90 this->m_tlm.sequencesCancelled++;
98 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
106 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
114 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
125 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
142 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
164 if (baseDir.
length() == 0) {
173 if (WasmSequencer::pathHasParentTraversal(fileName)) {
185 const char*
const separator = (baseLen > 0 && baseDir.
toChar()[baseLen - 1] ==
'/') ?
"" :
"/";
198 struct WasmFileReader {
199 explicit WasmFileReader(
Os::File& loadFile) : m_loadFile(loadFile) {}
203 const Os::File::Status status = this->m_loadFile.read(this->m_readBuf, size);
211 *outBuf = this->m_readBuf;
212 *outLen =
static_cast<std::size_t
>(size);
226 return static_cast<WasmFileReader*
>(userdata)->readChunk(outBuf, outLen);
237 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_load(
242 FW_ASSERT(this->m_guest_allocator !=
nullptr);
246 if (!this->resolveSequencePath(value.
get_fileName(), filePath)) {
264 this->takeAllocatorLock();
269 WasmFileReader reader(file);
273 &reader, this->m_guest_allocator, &moduleIndex);
275 next.
set_moduleIdx(static_cast<WasmSequencer_ModuleIdx>(moduleIndex));
277 this->releaseAllocatorLock();
289 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
293 U32 start_module_idx;
294 U32 start_function_idx;
300 this->m_invokeStatus =
spacewasm_invoke(this->m_wasm, start_module_idx, start_function_idx,
nullptr, 0);
303 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
314 this->m_invokeStatus =
317 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
322 auto problemStatus = this->validateModuleMain(value.
get_moduleIdx());
326 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
333 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
340 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
353 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
356 if (this->m_wasm ==
nullptr) {
359 FW_ASSERT(signal == Svc_WasmSequencer_ControllerStateMachine::Signal::__FPRIME_INITIAL_TRANSITION,
360 static_cast<FwAssertArgType>(signal));
364 this->destroyStore();
369 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
376 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
380 this->m_tlm.sequencesSucceeded++;
384 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
393 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
402 WasmSequencer_SequencePhase phase) {
403 switch (this->m_exit.reason) {
405 this->m_tlm.sequencesCancelled++;
409 this->m_tlm.sequencesFailed++;
413 this->m_tlm.sequencesFailed++;
420 this->m_tlm.sequencesFailed++;
429 this->m_tlm.sequencesFailed++;
431 this->m_exit.lastHostFunction);
440 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
444 U32 start_module_idx;
445 U32 start_function_idx;
447 &start_function_idx);
461 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
468 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
475 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
482 switch (this->m_exit.reason) {
485 return this->m_exit.code == 0;
491 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
494 return this->m_cancelRequested;
constexpr FwSizeType LOAD_READ_CHUNK_SIZE
void controller_sendSignal_loadFailed(const Svc::WasmSequencer_RequestContext &value)
Send signal loadFailed to state machine controller.
void log_WARNING_HI_ModuleStartInvokeFailed(const Svc::WasmSequencer_Status &status) const
Fw::ExternalString & get_fileName()
Get member fileName.
The interpreter exited via HOST_TRAP and we indicated HOST_PANIC in the host function.
void log_WARNING_HI_SequenceTrapped(Svc::WasmSequencer_ModuleIdx index, const Svc::WasmSequencer_SequencePhase &phase, const Svc::WasmSequencer_TrapReason &reason) const
PlatformSizeType FwSizeType
We got an unexpected async reply which caused us to abort.
Fw::ExternalString & get_moduleName()
Get member moduleName.
spacewasm_status_t spacewasm_module_start(struct spacewasm_t *engine, uint32_t module_idx, uint32_t *out_module_idx, uint32_t *out_func_index)
void log_WARNING_HI_SequenceFilePathNotContained(const Fw::StringBase &baseDir, const Fw::StringBase &fileName) const
spacewasm_status_t spacewasm_load_module(struct spacewasm_t *engine, const char *name, spacewasm_read_fn_t read, void *read_userdata, struct spacewasm_allocator_t *allocator, uint32_t *out_module_idx)
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
void log_WARNING_HI_FileOpenError(const Fw::StringBase &fileName, I32 status) const
void log_WARNING_LO_ControllerBusy(const Svc::WasmSequencer_SignalSource &signalSource, const Svc::WasmSequencer_ControllerStateMachine_State &state) const
A cancel signal was sent and we exited the interpreter.
An async host function replied with an error.
An async reply timeout overran while waiting for a host function reply.
spacewasm_status_t spacewasm_find_export_func(struct spacewasm_t *engine, uint32_t module_idx, const char *name, uint32_t *out_index)
Svc::WasmSequencer_SignalSource::T get_source() const
Get member source.
void log_WARNING_HI_SequencePanic(Svc::WasmSequencer_ModuleIdx index, const Svc::WasmSequencer_SequencePhase &phase, I32 code) const
Svc::BlockState::T get_block() const
Get member block.
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
Svc_WasmSequencer_ControllerStateMachine::State controller_getState() const
Get the state of state machine instance controller.
void controller_sendSignal_loadSucceeded(const Svc::WasmSequencer_RequestContext &value)
Send signal loadSucceeded to state machine controller.
const char * toChar() const
void log_WARNING_HI_SequenceExited(Svc::WasmSequencer_ModuleIdx index, const Svc::WasmSequencer_SequencePhase &phase, I32 code) const
void log_WARNING_HI_ModuleLoadFailed(const Svc::WasmSequencer_Status &status) const
Fw::ExternalString & get_moduleName()
Get member moduleName.
U8 WasmSequencer_ModuleIdx
const char * toChar() const
Convert to a C-style char*.
The interpreter exited via HOST_TRAP but a host function indicated it was a standard exit() ...
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Command successfully executed.
bool isConnected_seqStartOut_OutputPort(FwIndexType portNum) const
void log_ACTIVITY_HI_SequenceStarting(Svc::WasmSequencer_ModuleIdx index) const
uint8_t U8
8-bit unsigned integer
The module's optional start function.
Command had execution error.
void log_WARNING_LO_ControllerCannotInvoke() const
A sleep or host-function timer became incomparable (time base changed) and could not be evaluated...
Fw::ParamString paramGet_SEQ_BASE_DIR(Fw::ParamValid &valid)
void interpreter_sendSignal_run(const Svc::WasmSequencer_RequestContext &value)
Send signal run to state machine interpreter.
void log_ACTIVITY_HI_SequenceSucceeded(Svc::WasmSequencer_ModuleIdx index) const
void log_WARNING_HI_SequenceHostFailure(Svc::WasmSequencer_ModuleIdx index, const Svc::WasmSequencer_SequencePhase &phase, const Svc::WasmSequencer_ExitReason &reason, const Svc::WasmSequencer_HostFunction &hostFunction) const
void log_WARNING_LO_ModuleNotFound(const Fw::StringBase &module_name) const
Svc::WasmSequencer_RequestContext & get_context()
Get member context.
Svc::WasmSequencer_RequestContext & get_context()
Get member context.
void log_WARNING_HI_InvalidModuleEntrypoint(Svc::WasmSequencer_ModuleIdx moduleIdx, const Svc::WasmSequencer_Status &status) const
Log event InvalidModuleEntrypoint.
The interpreter exited normally and set m_exitCode.
spacewasm_status_t spacewasm_invoke(struct spacewasm_t *engine, uint32_t module_idx, uint32_t func_index, const struct spacewasm_value_t *params, size_t n)
void log_WARNING_HI_ModuleMainInvokeFailed(const Svc::WasmSequencer_Status &status) const
void seqStartOut_out(FwIndexType portNum, const Fw::StringBase &filename, const Svc::SeqArgs &args) const
Invoke output port seqStartOut.
Svc::WasmSequencer_ModuleIdx get_moduleIdx() const
Get member moduleIdx.
RateGroupDivider component implementation.
virtual SizeType length() const
Get the length of the string.
Enum representing parameter validity.
void log_ACTIVITY_HI_SequenceCancelled(Svc::WasmSequencer_ModuleIdx index, const Svc::WasmSequencer_SequencePhase &phase) const
void controller_sendSignal_invoked(const Svc::WasmSequencer_RequestContext &value)
Send signal invoked to state machine controller.
spacewasm_status_t spacewasm_find_module(struct spacewasm_t *engine, const char *name, uint32_t *out_index)
void set_moduleIdx(Svc::WasmSequencer_ModuleIdx moduleIdx)
Set member moduleIdx.
void log_WARNING_HI_SequenceFilePathTooLong(const Fw::StringBase &baseDir, const Fw::StringBase &fileName) const
void controller_sendSignal_invokeFailed(const Svc::WasmSequencer_RequestContext &value)
Send signal invokeFailed to state machine controller.
The module's main entrypoint.
The interpreter ran into a byte-code trap.
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
We did not explicitely set the exit reason, bug?
FormatStatus
status of string format calls