summaryrefslogtreecommitdiff
path: root/test/tx/cmake/module_qemu/src/module_shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tx/cmake/module_qemu/src/module_shared.h')
-rw-r--r--test/tx/cmake/module_qemu/src/module_shared.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/tx/cmake/module_qemu/src/module_shared.h b/test/tx/cmake/module_qemu/src/module_shared.h
new file mode 100644
index 00000000..7d239ce6
--- /dev/null
+++ b/test/tx/cmake/module_qemu/src/module_shared.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (c) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Claude Code (Opus 5.5).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Test */
+/** */
+/** Module execution harness: manager/module shared area */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+/* A module reports what it did through a small area of RAM that the manager
+ grants it with txm_module_manager_external_memory_enable. The area is at a
+ fixed address, outside everything the manager image links, so that both
+ images can name it without either knowing the other's layout. Its base and
+ size meet the Cortex-M MPU's rule that a region is a power of two in size
+ and aligned to that size. */
+
+#ifndef MODULE_SHARED_H
+#define MODULE_SHARED_H
+
+#define MODULE_SHARED_BASE ((ULONG) 0x20100000UL)
+#define MODULE_SHARED_SIZE ((ULONG) 256UL)
+#define MODULE_SHARED_WORDS (MODULE_SHARED_SIZE / ((ULONG) sizeof(ULONG)))
+
+#define MODULE_SHARED ((volatile ULONG *) MODULE_SHARED_BASE)
+
+/* Word indices. The manager writes the inputs before it starts a module; the
+ module writes the rest. A module writes MODULE_DONE_MAGIC to MODULE_DONE
+ last, after every other word it reports. */
+
+#define MODULE_IN_KERNEL_WORD ((ULONG) 0UL) /* Address of a kernel-only word */
+#define MODULE_IN_CYCLE ((ULONG) 1UL) /* Load cycle number, from 1 */
+
+#define MODULE_OUT_STARTED ((ULONG) 8UL) /* Start thread ran */
+#define MODULE_OUT_OBJECT_STATUS ((ULONG) 9UL) /* Worst object allocation status */
+#define MODULE_OUT_CREATE_STATUS ((ULONG) 10UL) /* Worst object creation status */
+#define MODULE_OUT_QUEUE_VALUE ((ULONG) 11UL) /* Message received back */
+#define MODULE_OUT_SEMAPHORE_STATUS ((ULONG) 12UL) /* Semaphore get status */
+#define MODULE_OUT_SLEEP_TICKS ((ULONG) 13UL) /* Ticks elapsed across tx_thread_sleep */
+#define MODULE_OUT_WORKER_RUNS ((ULONG) 14UL) /* Worker thread iterations */
+#define MODULE_OUT_CYCLE_SEEN ((ULONG) 15UL) /* Load cycle the module observed */
+#define MODULE_OUT_KERNEL_READ_TRY ((ULONG) 16UL) /* Kernel word read about to happen */
+#define MODULE_OUT_KERNEL_READ_DONE ((ULONG) 17UL) /* Kernel word read completed */
+#define MODULE_OUT_KERNEL_VALUE ((ULONG) 18UL) /* Value read from the kernel word */
+#define MODULE_OUT_CONTROL ((ULONG) 19UL) /* CONTROL as seen by the start thread */
+#define MODULE_DONE ((ULONG) 31UL)
+
+#define MODULE_DONE_MAGIC ((ULONG) 0x0D0E0D0EUL)
+#define MODULE_STARTED_MAGIC ((ULONG) 0x57A27EDUL)
+#define MODULE_QUEUE_MESSAGE ((ULONG) 0x12345678UL)
+
+#endif