24 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_processInvoke(
42 context.
set_moduleIdx(static_cast<WasmSequencer_ModuleIdx>(moduleIdx));
47 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_noblock_OK(
63 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_ERROR(
73 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_incrementSequenceFailure(
76 this->m_tlm.sequencesFailed++;
79 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_setCancelRequested(
82 this->m_cancelRequested =
true;
85 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_clearCancelRequested(
88 this->m_cancelRequested =
false;
91 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_cancelPendingRequest(
95 this->m_tlm.sequencesCancelled++;
100 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_BUSY(
108 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondInvoke_ERROR(
116 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respondLoad_BUSY(
124 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_block_OK(
141 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_respond_block_ERROR(
163 if (baseDir.
length() == 0) {
172 if (WasmSequencer::pathHasParentTraversal(fileName)) {
184 const char*
const separator = (baseLen > 0 && baseDir.
toChar()[baseLen - 1] ==
'/') ?
"" :
"/";
197 struct WasmFileReader {
198 explicit WasmFileReader(
Os::File& loadFile) : m_loadFile(loadFile) {}
202 const Os::File::Status status = this->m_loadFile.read(this->m_readBuf, size);
210 *outBuf = this->m_readBuf;
211 *outLen =
static_cast<std::size_t
>(size);
225 return static_cast<WasmFileReader*
>(userdata)->readChunk(outBuf, outLen);
236 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_load(
241 FW_ASSERT(this->m_guest_allocator !=
nullptr);
247 if (!this->resolveSequencePath(value.
get_fileName(), filePath)) {
265 this->takeAllocatorLock();
270 WasmFileReader reader(file);
274 &reader, this->m_guest_allocator, &moduleIndex);
276 next.
set_moduleIdx(static_cast<WasmSequencer_ModuleIdx>(moduleIndex));
278 this->releaseAllocatorLock();
290 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_invokeStart(
294 U32 start_module_idx;
295 U32 start_function_idx;
301 this->m_invokeStatus =
spacewasm_invoke(this->m_wasm, start_module_idx, start_function_idx,
nullptr, 0);
304 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_invokeMain(
315 this->m_invokeStatus =
318 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleInvalidMain(
323 auto problemStatus = this->validateModuleMain(value.
get_moduleIdx());
327 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainInvokeFailed(
334 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartInvokeFailed(
341 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStarted(
354 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_resetStore(
357 if (this->m_wasm ==
nullptr) {
360 FW_ASSERT(signal == Svc_WasmSequencer_ControllerStateMachine::Signal::__FPRIME_INITIAL_TRANSITION,
361 static_cast<FwAssertArgType>(signal));
365 this->destroyStore();
370 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_runEngine(
377 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleSucceeded(
381 this->m_tlm.sequencesSucceeded++;
385 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleStartFailed(
394 void WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_action_reportModuleMainFailed(
403 WasmSequencer_SequencePhase phase) {
404 switch (this->m_exit.reason) {
406 this->m_tlm.sequencesCancelled++;
410 this->m_tlm.sequencesFailed++;
414 this->m_tlm.sequencesFailed++;
421 this->m_tlm.sequencesFailed++;
430 this->m_tlm.sequencesFailed++;
432 this->m_exit.lastHostFunction);
441 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasStart(
445 U32 start_module_idx;
446 U32 start_function_idx;
448 &start_function_idx);
462 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_moduleHasValidMain(
469 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_invokeSucceeded(
476 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_interpreterSucceeded(
483 switch (this->m_exit.reason) {
486 return this->m_exit.code == 0;
492 bool WasmSequencer ::Svc_WasmSequencer_ControllerStateMachine_guard_cancelRequested(
495 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*.
Svc::SeqArgs & get_args()
Get member args.
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)
Svc::SeqArgs & get_args()
Get member args.
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