summaryrefslogtreecommitdiff
path: root/common_modules
diff options
context:
space:
mode:
authorScott Larson <[email protected]>2020-08-07 16:56:45 -0700
committerScott Larson <[email protected]>2020-08-07 16:56:45 -0700
commit6f61053f2ac6cfa01a33b910401a61e63bca0972 (patch)
tree7ba850077c3fb4d024c8f6d59609e94c6c627707 /common_modules
parent49e3c27f3f140cd76147d85ccbb1eea31e09ee16 (diff)
add SMP, Modules, and more processor/tools releases
Diffstat (limited to 'common_modules')
-rw-r--r--common_modules/inc/txm_module.h684
-rw-r--r--common_modules/inc/txm_module_user.h60
-rw-r--r--common_modules/module_lib/src/txm_block_allocate.c80
-rw-r--r--common_modules/module_lib/src/txm_block_pool_create.c89
-rw-r--r--common_modules/module_lib/src/txm_block_pool_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_block_pool_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_block_pool_performance_info_get.c87
-rw-r--r--common_modules/module_lib/src/txm_block_pool_performance_system_info_get.c84
-rw-r--r--common_modules/module_lib/src/txm_block_pool_prioritize.c73
-rw-r--r--common_modules/module_lib/src/txm_block_release.c74
-rw-r--r--common_modules/module_lib/src/txm_byte_allocate.c86
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_create.c87
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_performance_info_get.c98
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_performance_system_info_get.c95
-rw-r--r--common_modules/module_lib/src/txm_byte_pool_prioritize.c73
-rw-r--r--common_modules/module_lib/src/txm_byte_release.c75
-rw-r--r--common_modules/module_lib/src/txm_event_flags_create.c79
-rw-r--r--common_modules/module_lib/src/txm_event_flags_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_event_flags_get.c89
-rw-r--r--common_modules/module_lib/src/txm_event_flags_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_event_flags_performance_info_get.c88
-rw-r--r--common_modules/module_lib/src/txm_event_flags_performance_system_info_get.c84
-rw-r--r--common_modules/module_lib/src/txm_event_flags_set.c79
-rw-r--r--common_modules/module_lib/src/txm_event_flags_set_notify.c76
-rw-r--r--common_modules/module_lib/src/txm_module_application_request.c78
-rw-r--r--common_modules/module_lib/src/txm_module_callback_request_thread_entry.c244
-rw-r--r--common_modules/module_lib/src/txm_module_object_allocate.c79
-rw-r--r--common_modules/module_lib/src/txm_module_object_deallocate.c73
-rw-r--r--common_modules/module_lib/src/txm_module_object_pointer_get.c89
-rw-r--r--common_modules/module_lib/src/txm_module_object_pointer_get_extended.c96
-rw-r--r--common_modules/module_lib/src/txm_module_thread_system_suspend.c81
-rw-r--r--common_modules/module_lib/src/txm_mutex_create.c84
-rw-r--r--common_modules/module_lib/src/txm_mutex_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_mutex_get.c76
-rw-r--r--common_modules/module_lib/src/txm_mutex_info_get.c91
-rw-r--r--common_modules/module_lib/src/txm_mutex_performance_info_get.c93
-rw-r--r--common_modules/module_lib/src/txm_mutex_performance_system_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_mutex_prioritize.c73
-rw-r--r--common_modules/module_lib/src/txm_mutex_put.c74
-rw-r--r--common_modules/module_lib/src/txm_queue_create.c87
-rw-r--r--common_modules/module_lib/src/txm_queue_delete.c75
-rw-r--r--common_modules/module_lib/src/txm_queue_flush.c75
-rw-r--r--common_modules/module_lib/src/txm_queue_front_send.c78
-rw-r--r--common_modules/module_lib/src/txm_queue_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_queue_performance_info_get.c91
-rw-r--r--common_modules/module_lib/src/txm_queue_performance_system_info_get.c90
-rw-r--r--common_modules/module_lib/src/txm_queue_prioritize.c73
-rw-r--r--common_modules/module_lib/src/txm_queue_receive.c80
-rw-r--r--common_modules/module_lib/src/txm_queue_send.c78
-rw-r--r--common_modules/module_lib/src/txm_queue_send_notify.c76
-rw-r--r--common_modules/module_lib/src/txm_semaphore_ceiling_put.c77
-rw-r--r--common_modules/module_lib/src/txm_semaphore_create.c83
-rw-r--r--common_modules/module_lib/src/txm_semaphore_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_semaphore_get.c76
-rw-r--r--common_modules/module_lib/src/txm_semaphore_info_get.c89
-rw-r--r--common_modules/module_lib/src/txm_semaphore_performance_info_get.c87
-rw-r--r--common_modules/module_lib/src/txm_semaphore_performance_system_info_get.c84
-rw-r--r--common_modules/module_lib/src/txm_semaphore_prioritize.c73
-rw-r--r--common_modules/module_lib/src/txm_semaphore_put.c74
-rw-r--r--common_modules/module_lib/src/txm_semaphore_put_notify.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_create.c100
-rw-r--r--common_modules/module_lib/src/txm_thread_delete.c75
-rw-r--r--common_modules/module_lib/src/txm_thread_entry_exit_notify.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_identify.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_info_get.c95
-rw-r--r--common_modules/module_lib/src/txm_thread_interrupt_control.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_performance_info_get.c110
-rw-r--r--common_modules/module_lib/src/txm_thread_performance_system_info_get.c110
-rw-r--r--common_modules/module_lib/src/txm_thread_preemption_change.c79
-rw-r--r--common_modules/module_lib/src/txm_thread_priority_change.c79
-rw-r--r--common_modules/module_lib/src/txm_thread_relinquish.c70
-rw-r--r--common_modules/module_lib/src/txm_thread_reset.c75
-rw-r--r--common_modules/module_lib/src/txm_thread_resume.c74
-rw-r--r--common_modules/module_lib/src/txm_thread_sleep.c74
-rw-r--r--common_modules/module_lib/src/txm_thread_stack_error_notify.c78
-rw-r--r--common_modules/module_lib/src/txm_thread_suspend.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_terminate.c76
-rw-r--r--common_modules/module_lib/src/txm_thread_time_slice_change.c78
-rw-r--r--common_modules/module_lib/src/txm_thread_wait_abort.c74
-rw-r--r--common_modules/module_lib/src/txm_time_get.c74
-rw-r--r--common_modules/module_lib/src/txm_time_set.c70
-rw-r--r--common_modules/module_lib/src/txm_timer_activate.c76
-rw-r--r--common_modules/module_lib/src/txm_timer_change.c79
-rw-r--r--common_modules/module_lib/src/txm_timer_create.c92
-rw-r--r--common_modules/module_lib/src/txm_timer_deactivate.c75
-rw-r--r--common_modules/module_lib/src/txm_timer_delete.c76
-rw-r--r--common_modules/module_lib/src/txm_timer_info_get.c88
-rw-r--r--common_modules/module_lib/src/txm_timer_performance_info_get.c91
-rw-r--r--common_modules/module_lib/src/txm_timer_performance_system_info_get.c87
-rw-r--r--common_modules/module_lib/src/txm_trace_buffer_full_notify.c77
-rw-r--r--common_modules/module_lib/src/txm_trace_disable.c73
-rw-r--r--common_modules/module_lib/src/txm_trace_enable.c77
-rw-r--r--common_modules/module_lib/src/txm_trace_event_filter.c74
-rw-r--r--common_modules/module_lib/src/txm_trace_event_unfilter.c74
-rw-r--r--common_modules/module_lib/src/txm_trace_interrupt_control.c74
-rw-r--r--common_modules/module_lib/src/txm_trace_isr_enter_insert.c70
-rw-r--r--common_modules/module_lib/src/txm_trace_isr_exit_insert.c70
-rw-r--r--common_modules/module_lib/src/txm_trace_user_event_insert.c82
-rw-r--r--common_modules/module_manager/inc/txm_module_manager_dispatch.h3029
-rw-r--r--common_modules/module_manager/inc/txm_module_manager_util.h188
-rw-r--r--common_modules/module_manager/src/txm_module_manager_application_request.c79
-rw-r--r--common_modules/module_manager/src/txm_module_manager_callback_request.c176
-rw-r--r--common_modules/module_manager/src/txm_module_manager_event_flags_notify_trampoline.c133
-rw-r--r--common_modules/module_manager/src/txm_module_manager_file_load.c217
-rw-r--r--common_modules/module_manager/src/txm_module_manager_in_place_load.c120
-rw-r--r--common_modules/module_manager/src/txm_module_manager_initialize.c186
-rw-r--r--common_modules/module_manager/src/txm_module_manager_internal_load.c424
-rw-r--r--common_modules/module_manager/src/txm_module_manager_kernel_dispatch.c741
-rw-r--r--common_modules/module_manager/src/txm_module_manager_maximum_module_priority_set.c116
-rw-r--r--common_modules/module_manager/src/txm_module_manager_memory_load.c162
-rw-r--r--common_modules/module_manager/src/txm_module_manager_object_allocate.c155
-rw-r--r--common_modules/module_manager/src/txm_module_manager_object_deallocate.c138
-rw-r--r--common_modules/module_manager/src/txm_module_manager_object_pointer_get.c91
-rw-r--r--common_modules/module_manager/src/txm_module_manager_object_pointer_get_extended.c506
-rw-r--r--common_modules/module_manager/src/txm_module_manager_object_pool_create.c82
-rw-r--r--common_modules/module_manager/src/txm_module_manager_properties_get.c106
-rw-r--r--common_modules/module_manager/src/txm_module_manager_queue_notify_trampoline.c132
-rw-r--r--common_modules/module_manager/src/txm_module_manager_semaphore_notify_trampoline.c131
-rw-r--r--common_modules/module_manager/src/txm_module_manager_start.c226
-rw-r--r--common_modules/module_manager/src/txm_module_manager_stop.c571
-rw-r--r--common_modules/module_manager/src/txm_module_manager_thread_create.c585
-rw-r--r--common_modules/module_manager/src/txm_module_manager_thread_notify_trampoline.c153
-rw-r--r--common_modules/module_manager/src/txm_module_manager_thread_reset.c180
-rw-r--r--common_modules/module_manager/src/txm_module_manager_timer_notify_trampoline.c141
-rw-r--r--common_modules/module_manager/src/txm_module_manager_unload.c197
-rw-r--r--common_modules/module_manager/src/txm_module_manager_util.c417
128 files changed, 18235 insertions, 0 deletions
diff --git a/common_modules/inc/txm_module.h b/common_modules/inc/txm_module.h
new file mode 100644
index 00000000..8625cf40
--- /dev/null
+++ b/common_modules/inc/txm_module.h
@@ -0,0 +1,684 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Interface (API) */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/**************************************************************************/
+/* */
+/* APPLICATION INTERFACE DEFINITION RELEASE */
+/* */
+/* txm_module.h PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file defines the basic module constants, interface structures, */
+/* and function prototypes. */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+
+#ifndef TXM_MODULE_H
+#define TXM_MODULE_H
+
+
+/* Include the standard ThreadX API file. */
+
+#include "tx_api.h"
+
+/* Include the module port specific file. */
+
+#include "txm_module_port.h"
+
+
+/* Include any supported external component include files. */
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+#include "txm_module_filex.h"
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+#include "txm_module_guix.h"
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETX
+#include "txm_module_netx.h"
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+#include "txm_module_netxduo.h"
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+#include "txm_module_usbx.h"
+#endif
+
+
+#ifdef FX_FILEX_PRESENT
+#include "fx_api.h"
+#endif
+
+
+/* Determine if a C++ compiler is being used. If so, ensure that standard
+ C is used to process the API information. */
+
+#ifdef __cplusplus
+
+/* Yes, C++ compiler is present. Use standard C. */
+extern "C" {
+
+#endif
+
+
+/* Define the Module ID, which is used to indicate a module is valid. */
+
+#define TXM_MODULE_ID 0x4D4F4455
+
+
+/* Define valid module states. */
+
+#define TXM_MODULE_LOADED 1
+#define TXM_MODULE_STARTED 2
+#define TXM_MODULE_STOPPING 3
+#define TXM_MODULE_STOPPED 4
+#define TXM_MODULE_UNLOADED 5
+
+
+/* Define module manager error codes. */
+
+#define TXM_MODULE_ALIGNMENT_ERROR 0xF0
+#define TXM_MODULE_ALREADY_LOADED 0xF1
+#define TXM_MODULE_INVALID 0xF2
+#define TXM_MODULE_INVALID_PROPERTIES 0xF3
+#define TXM_MODULE_INVALID_MEMORY 0xF4
+#define TXM_MODULE_INVALID_CALLBACK 0xF5
+#define TXM_MODULE_INVALID_STACK_SIZE 0xF6
+#define TXM_MODULE_FILEX_INVALID_BYTES_READ 0xF7
+#define TXM_MODULE_MATH_OVERFLOW 0xF8
+
+
+/* Define the data area alignment mask, must be a power of 2. */
+
+#ifndef TXM_MODULE_DATA_ALIGNMENT
+#define TXM_MODULE_DATA_ALIGNMENT 4
+#endif
+
+
+/* Define the code area alignment mask, must be a power of 2. */
+
+#ifndef TXM_MODULE_CODE_ALIGNMENT
+#define TXM_MODULE_CODE_ALIGNMENT 4
+#endif
+
+
+/* Define module timeout for waiting for module to finish. */
+
+#ifndef TXM_MODULE_TIMEOUT
+#define TXM_MODULE_TIMEOUT 100
+#endif
+
+
+/* Define module thread time-slice default. */
+
+#ifndef TXM_MODULE_TIME_SLICE
+#define TXM_MODULE_TIME_SLICE 4
+#endif
+
+
+/* Define each module's callback queue depth. This is used to queue up incoming call back requests. */
+
+#ifndef TXM_MODULE_CALLBACKS_QUEUE_DEPTH
+#define TXM_MODULE_CALLBACKS_QUEUE_DEPTH 8 /* Number queued callback requests. */
+#endif
+
+
+/* Define the module manager thread's stack size. */
+
+#ifndef TXM_MODULE_MANAGER_THREAD_STACK_SIZE
+#define TXM_MODULE_MANAGER_THREAD_STACK_SIZE 1024
+#endif
+
+
+/* Define the module manager thread's priority. */
+
+#ifndef TXM_MODULE_MANAGER_THREAD_PRIORITY
+#define TXM_MODULE_MANAGER_THREAD_PRIORITY 1
+#endif
+
+
+/* Define the module's callback handler thread's stack size. */
+
+#ifndef TXM_MODULE_CALLBACK_THREAD_STACK_SIZE
+#define TXM_MODULE_CALLBACK_THREAD_STACK_SIZE 1024
+#endif
+
+
+/* Define the default port-specific macro for resetting the thread. */
+
+#ifndef TXM_MODULE_MANAGER_THREAD_RESET_PORT_COMPLETION
+#define TXM_MODULE_MANAGER_THREAD_RESET_PORT_COMPLETION(thread_ptr, module_instance)
+#endif
+
+
+/* Define object types for object search requests. */
+
+#define TXM_BLOCK_POOL_OBJECT 1
+#define TXM_BYTE_POOL_OBJECT 2
+#define TXM_EVENT_FLAGS_OBJECT 3
+#define TXM_MUTEX_OBJECT 4
+#define TXM_QUEUE_OBJECT 5
+#define TXM_SEMAPHORE_OBJECT 6
+#define TXM_THREAD_OBJECT 7
+#define TXM_TIMER_OBJECT 8
+#define TXM_THREAD_KERNEL_STACK_OBJECT 77
+#define TXM_FILEX_OBJECTS_START 100
+#define TXM_FILEX_OBJECTS_END 199
+#define TXM_NETX_OBJECTS_START 200
+#define TXM_NETX_OBJECTS_END 299
+#define TXM_NETXDUO_OBJECTS_START 300
+#define TXM_NETXDUO_OBJECTS_END 399
+#define TXM_USBX_OBJECTS_START 400
+#define TXM_USBX_OBJECTS_END 499
+#define TXM_GUIX_OBJECTS_START 500
+#define TXM_GUIX_OBJECT_END 599
+
+
+/* Define callback types. */
+#define TXM_THREADX_CALLBACKS_START 0
+#define TXM_THREADX_CALLBACKS_END 99
+#define TXM_FILEX_CALLBACKS_START 100
+#define TXM_FILEX_CALLBACKS_END 199
+#define TXM_NETX_CALLBACKS_START 200
+#define TXM_NETX_CALLBACKS_END 299
+#define TXM_NETXDUO_CALLBACKS_START 300
+#define TXM_NETXDUO_CALLBACKS_END 399
+#define TXM_USBX_CALLBACKS_START 400
+#define TXM_USBX_CALLBACKS_END 499
+#define TXM_GUIX_CALLBACKS_START 500
+#define TXM_GUIX_CALLBACKS_END 599
+
+#define TXM_TIMER_CALLBACK 0
+#define TXM_EVENTS_SET_CALLBACK 1
+#define TXM_QUEUE_SEND_CALLBACK 2
+#define TXM_SEMAPHORE_PUT_CALLBACK 3
+#define TXM_THREAD_ENTRY_EXIT_CALLBACK 4
+
+
+/* Determine the ThreadX kernel API call IDs. */
+
+#define TXM_BLOCK_ALLOCATE_CALL 1
+#define TXM_BLOCK_POOL_CREATE_CALL 2
+#define TXM_BLOCK_POOL_DELETE_CALL 3
+#define TXM_BLOCK_POOL_INFO_GET_CALL 4
+#define TXM_BLOCK_POOL_PERFORMANCE_INFO_GET_CALL 5
+#define TXM_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL 6
+#define TXM_BLOCK_POOL_PRIORITIZE_CALL 7
+#define TXM_BLOCK_RELEASE_CALL 8
+#define TXM_BYTE_ALLOCATE_CALL 9
+#define TXM_BYTE_POOL_CREATE_CALL 10
+#define TXM_BYTE_POOL_DELETE_CALL 11
+#define TXM_BYTE_POOL_INFO_GET_CALL 12
+#define TXM_BYTE_POOL_PERFORMANCE_INFO_GET_CALL 13
+#define TXM_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL 14
+#define TXM_BYTE_POOL_PRIORITIZE_CALL 15
+#define TXM_BYTE_RELEASE_CALL 16
+#define TXM_EVENT_FLAGS_CREATE_CALL 17
+#define TXM_EVENT_FLAGS_DELETE_CALL 18
+#define TXM_EVENT_FLAGS_GET_CALL 19
+#define TXM_EVENT_FLAGS_INFO_GET_CALL 20
+#define TXM_EVENT_FLAGS_PERFORMANCE_INFO_GET_CALL 21
+#define TXM_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET_CALL 22
+#define TXM_EVENT_FLAGS_SET_CALL 23
+#define TXM_EVENT_FLAGS_SET_NOTIFY_CALL 24
+#define TXM_THREAD_INTERRUPT_CONTROL_CALL 25
+#define TXM_MUTEX_CREATE_CALL 26
+#define TXM_MUTEX_DELETE_CALL 27
+#define TXM_MUTEX_GET_CALL 28
+#define TXM_MUTEX_INFO_GET_CALL 29
+#define TXM_MUTEX_PERFORMANCE_INFO_GET_CALL 30
+#define TXM_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_CALL 31
+#define TXM_MUTEX_PRIORITIZE_CALL 32
+#define TXM_MUTEX_PUT_CALL 33
+#define TXM_QUEUE_CREATE_CALL 34
+#define TXM_QUEUE_DELETE_CALL 35
+#define TXM_QUEUE_FLUSH_CALL 36
+#define TXM_QUEUE_FRONT_SEND_CALL 37
+#define TXM_QUEUE_INFO_GET_CALL 38
+#define TXM_QUEUE_PERFORMANCE_INFO_GET_CALL 39
+#define TXM_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_CALL 40
+#define TXM_QUEUE_PRIORITIZE_CALL 41
+#define TXM_QUEUE_RECEIVE_CALL 42
+#define TXM_QUEUE_SEND_CALL 43
+#define TXM_QUEUE_SEND_NOTIFY_CALL 44
+#define TXM_SEMAPHORE_CEILING_PUT_CALL 45
+#define TXM_SEMAPHORE_CREATE_CALL 46
+#define TXM_SEMAPHORE_DELETE_CALL 47
+#define TXM_SEMAPHORE_GET_CALL 48
+#define TXM_SEMAPHORE_INFO_GET_CALL 49
+#define TXM_SEMAPHORE_PERFORMANCE_INFO_GET_CALL 50
+#define TXM_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_CALL 51
+#define TXM_SEMAPHORE_PRIORITIZE_CALL 52
+#define TXM_SEMAPHORE_PUT_CALL 53
+#define TXM_SEMAPHORE_PUT_NOTIFY_CALL 54
+#define TXM_THREAD_CREATE_CALL 55
+#define TXM_THREAD_DELETE_CALL 56
+#define TXM_THREAD_ENTRY_EXIT_NOTIFY_CALL 57
+#define TXM_THREAD_IDENTIFY_CALL 58
+#define TXM_THREAD_INFO_GET_CALL 59
+#define TXM_THREAD_PERFORMANCE_INFO_GET_CALL 60
+#define TXM_THREAD_PERFORMANCE_SYSTEM_INFO_GET_CALL 61
+#define TXM_THREAD_PREEMPTION_CHANGE_CALL 62
+#define TXM_THREAD_PRIORITY_CHANGE_CALL 63
+#define TXM_THREAD_RELINQUISH_CALL 64
+#define TXM_THREAD_RESET_CALL 65
+#define TXM_THREAD_RESUME_CALL 66
+#define TXM_THREAD_SLEEP_CALL 67
+#define TXM_THREAD_STACK_ERROR_NOTIFY_CALL 68
+#define TXM_THREAD_SUSPEND_CALL 69
+#define TXM_THREAD_TERMINATE_CALL 70
+#define TXM_THREAD_TIME_SLICE_CHANGE_CALL 71
+#define TXM_THREAD_WAIT_ABORT_CALL 72
+#define TXM_TIME_GET_CALL 73
+#define TXM_TIME_SET_CALL 74
+#define TXM_TIMER_ACTIVATE_CALL 75
+#define TXM_TIMER_CHANGE_CALL 76
+#define TXM_TIMER_CREATE_CALL 77
+#define TXM_TIMER_DEACTIVATE_CALL 78
+#define TXM_TIMER_DELETE_CALL 79
+#define TXM_TIMER_INFO_GET_CALL 80
+#define TXM_TIMER_PERFORMANCE_INFO_GET_CALL 81
+#define TXM_TIMER_PERFORMANCE_SYSTEM_INFO_GET_CALL 82
+#define TXM_TRACE_ENABLE_CALL 83
+#define TXM_TRACE_EVENT_FILTER_CALL 84
+#define TXM_TRACE_EVENT_UNFILTER_CALL 85
+#define TXM_TRACE_DISABLE_CALL 86
+#define TXM_TRACE_INTERRUPT_CONTROL_CALL 87
+#define TXM_TRACE_ISR_ENTER_INSERT_CALL 88
+#define TXM_TRACE_ISR_EXIT_INSERT_CALL 89
+#define TXM_TRACE_BUFFER_FULL_NOTIFY_CALL 90
+#define TXM_TRACE_USER_EVENT_INSERT_CALL 91
+#define TXM_THREAD_SYSTEM_SUSPEND_CALL 92
+#define TXM_MODULE_OBJECT_POINTER_GET_CALL 93
+#define TXM_MODULE_OBJECT_POINTER_GET_EXTENDED_CALL 94
+#define TXM_MODULE_OBJECT_ALLOCATE_CALL 95
+#define TXM_MODULE_OBJECT_DEALLOCATE_CALL 96
+
+
+/* Determine the API call IDs for other components. */
+
+#define TXM_FILEX_API_ID_START 1000
+#define TXM_FILEX_API_ID_END 1999
+#define TXM_NETX_API_ID_START 2000
+#define TXM_NETX_API_ID_END 2999
+#define TXM_NETXDUO_API_ID_START 3000
+#define TXM_NETXDUO_API_ID_END 3999
+#define TXM_USBX_API_ID_START 4000
+#define TXM_USBX_API_ID_END 4999
+#define TXM_GUIX_API_ID_START 5000
+#define TXM_GUIX_API_ID_END 5999
+
+
+/* Determine the application's IDs for calling application code in the resident area. */
+
+#define TXM_APPLICATION_REQUEST_ID_BASE 0x10000
+
+
+/* Define the overlay for the module's preamble. */
+
+typedef struct TXM_MODULE_PREAMBLE_STRUCT
+{
+ /* Meaning */
+ ULONG txm_module_preamble_id; /* Download Module ID (0x54584D44) */
+ ULONG txm_module_preamble_version_major; /* Major Version ID */
+ ULONG txm_module_preamble_version_minor; /* Minor Version ID */
+ ULONG txm_module_preamble_preamble_size; /* Module Preamble Size, in 32-bit words */
+ ULONG txm_module_preamble_application_module_id; /* Module ID (application defined) */
+ ULONG txm_module_preamble_property_flags; /* Properties Bit Map */
+ ULONG txm_module_preamble_shell_entry_function; /* Module shell Entry Function */
+ ULONG txm_module_preamble_start_function; /* Module Thread Start Function */
+ ULONG txm_module_preamble_stop_function; /* Module Thread Stop Function */
+ ULONG txm_module_preamble_start_stop_priority; /* Module Start/Stop Thread Priority */
+ ULONG txm_module_preamble_start_stop_stack_size; /* Module Start/Stop Thread Priority */
+ ULONG txm_module_preamble_callback_function; /* Module Callback Thread Function */
+ ULONG txm_module_preamble_callback_priority; /* Module Callback Thread Priority */
+ ULONG txm_module_preamble_callback_stack_size; /* Module Callback Thread Stack Size */
+ ULONG txm_module_preamble_code_size; /* Module Instruction Area Size */
+ ULONG txm_module_preamble_data_size; /* Module Data Area Size */
+ ULONG txm_module_preamble_reserved_0; /* Reserved */
+ ULONG txm_module_preamble_reserved_1; /* Reserved */
+ ULONG txm_module_preamble_reserved_2; /* Reserved */
+ ULONG txm_module_preamble_reserved_3; /* Reserved */
+ ULONG txm_module_preamble_reserved_4; /* Reserved */
+ ULONG txm_module_preamble_reserved_5; /* Reserved */
+ ULONG txm_module_preamble_reserved_6; /* Reserved */
+ ULONG txm_module_preamble_reserved_7; /* Reserved */
+ ULONG txm_module_preamble_reserved_8; /* Reserved */
+ ULONG txm_module_preamble_reserved_9; /* Reserved */
+ ULONG txm_module_preamble_reserved_10; /* Reserved */
+ ULONG txm_module_preamble_reserved_11; /* Reserved */
+ ULONG txm_module_preamble_reserved_12; /* Reserved */
+ ULONG txm_module_preamble_reserved_13; /* Reserved */
+ ULONG txm_module_preamble_reserved_14; /* Reserved */
+ ULONG txm_module_preamble_checksum; /* Module Instruction Area Checksum [Optional] */
+
+} TXM_MODULE_PREAMBLE;
+
+
+struct TXM_MODULE_ALLOCATED_OBJECT_STRUCT;
+
+
+/* Define the callback notification structure used to communicate between the module's callback handling thread
+ and the module manager. */
+
+typedef struct TXM_MODULE_CALLBACK_MESSAGE_STRUCT
+{
+ ULONG txm_module_callback_message_type;
+ ULONG txm_module_callback_message_activation_count;
+ VOID (*txm_module_callback_message_application_function)(VOID);
+ ALIGN_TYPE txm_module_callback_message_param_1;
+ ALIGN_TYPE txm_module_callback_message_param_2;
+ ALIGN_TYPE txm_module_callback_message_param_3;
+ ALIGN_TYPE txm_module_callback_message_param_4;
+ ALIGN_TYPE txm_module_callback_message_param_5;
+ ALIGN_TYPE txm_module_callback_message_param_6;
+ ALIGN_TYPE txm_module_callback_message_param_7;
+ ALIGN_TYPE txm_module_callback_message_param_8;
+ ALIGN_TYPE txm_module_callback_message_reserved1;
+ ALIGN_TYPE txm_module_callback_message_reserved2;
+} TXM_MODULE_CALLBACK_MESSAGE;
+
+
+/* Define the module's instance for the manager. */
+
+typedef struct TXM_MODULE_INSTANCE_STRUCT
+{
+ ULONG txm_module_instance_id;
+ CHAR *txm_module_instance_name;
+ ULONG txm_module_instance_state;
+ ULONG txm_module_instance_property_flags;
+ VOID *txm_module_instance_code_allocation_ptr;
+ ULONG txm_module_instance_code_allocation_size;
+ VOID *txm_module_instance_code_start;
+ VOID *txm_module_instance_code_end;
+ ULONG txm_module_instance_code_size;
+ VOID *txm_module_instance_data_allocation_ptr;
+ ULONG txm_module_instance_data_allocation_size;
+ VOID *txm_module_instance_data_start;
+ VOID *txm_module_instance_data_end;
+ VOID *txm_module_instance_module_data_base_address;
+ ULONG txm_module_instance_data_size;
+ ULONG txm_module_instance_total_ram_usage;
+ VOID *txm_module_instance_start_stop_stack_start_address;
+ VOID *txm_module_instance_start_stop_stack_end_address;
+ VOID *txm_module_instance_callback_stack_start_address;
+ VOID *txm_module_instance_callback_stack_end_address;
+ TXM_MODULE_PREAMBLE *txm_module_instance_preamble_ptr;
+ VOID (*txm_module_instance_shell_entry_function)(TX_THREAD *, struct TXM_MODULE_INSTANCE_STRUCT *);
+ VOID (*txm_module_instance_start_thread_entry)(ULONG);
+ VOID (*txm_module_instance_stop_thread_entry)(ULONG);
+ VOID (*txm_module_instance_callback_request_thread_entry)(ULONG);
+
+ /* Define the port extention to the module manager structure. */
+ TXM_MODULE_MANAGER_PORT_EXTENSION
+
+ TX_THREAD txm_module_instance_start_stop_thread;
+ TX_THREAD txm_module_instance_callback_request_thread;
+ TX_QUEUE txm_module_instance_callback_request_queue;
+ ULONG txm_module_instance_callback_request_queue_area[TXM_MODULE_CALLBACKS_QUEUE_DEPTH * (sizeof(TXM_MODULE_CALLBACK_MESSAGE)/sizeof(ULONG))];
+ ULONG txm_module_instance_start_stop_stack_size;
+ ULONG txm_module_instance_start_stop_priority;
+ ULONG txm_module_instance_callback_stack_size;
+ ULONG txm_module_instance_callback_priority;
+ ULONG txm_module_instance_application_module_id;
+ UINT txm_module_instance_maximum_priority;
+
+ /* Define the head pointer of the list of objects allocated by the module. */
+ struct TXM_MODULE_ALLOCATED_OBJECT_STRUCT
+ *txm_module_instance_object_list_head;
+ ULONG txm_module_instance_object_list_count;
+
+ struct TXM_MODULE_INSTANCE_STRUCT
+ *txm_module_instance_loaded_next,
+ *txm_module_instance_loaded_previous;
+} TXM_MODULE_INSTANCE;
+
+
+/* Determine if the thread entry info control block has an extension defined. If not, define the extension to
+ whitespace. */
+
+#ifndef TXM_MODULE_THREAD_ENTRY_INFO_USER_EXTENSION
+#define TXM_MODULE_THREAD_ENTRY_INFO_USER_EXTENSION
+#endif
+
+
+/* Define the thread entry information structure. This structure is placed on the thread's stack such that the
+ module's _txm_thread_shell_entry function does not need to access anything in the thread control block. */
+
+typedef struct TXM_MODULE_THREAD_ENTRY_INFO_STRUCT
+{
+ TX_THREAD *txm_module_thread_entry_info_thread;
+ TXM_MODULE_INSTANCE *txm_module_thread_entry_info_module;
+ VOID *txm_module_thread_entry_info_data_base_address; /* Don't move this, referenced in stack build to setup module data base register. */
+ VOID *txm_module_thread_entry_info_code_base_address;
+ VOID (*txm_module_thread_entry_info_entry)(ULONG);
+ ULONG txm_module_thread_entry_info_parameter;
+ VOID (*txm_module_thread_entry_info_exit_notify)(struct TX_THREAD_STRUCT *, UINT);
+ UINT txm_module_thread_entry_info_start_thread;
+ TX_THREAD *txm_module_thread_entry_info_callback_request_thread;
+ TX_QUEUE *txm_module_thread_entry_info_callback_request_queue;
+ VOID *txm_module_thread_entry_info_reserved;
+ ALIGN_TYPE (*txm_module_thread_entry_info_kernel_call_dispatcher)(ULONG kernel_request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3);
+ TXM_MODULE_THREAD_ENTRY_INFO_USER_EXTENSION
+} TXM_MODULE_THREAD_ENTRY_INFO;
+
+
+/* Define the linked-list structure used to maintain the module's object allocation. */
+
+typedef struct TXM_MODULE_ALLOCATED_OBJECT_STRUCT
+{
+
+ TXM_MODULE_INSTANCE *txm_module_allocated_object_module_instance;
+ struct TXM_MODULE_ALLOCATED_OBJECT_STRUCT
+ *txm_module_allocated_object_next,
+ *txm_module_allocated_object_previous;
+ ULONG txm_module_object_size;
+} TXM_MODULE_ALLOCATED_OBJECT;
+
+
+/* Determine if module code is being compiled. If so, remap the ThreadX API to
+ the module shell functions that will go through the module <-> module manager
+ interface. */
+
+#ifdef TXM_MODULE
+
+
+/* Define the external reference to the module manager kernel dispatcher function pointer. This is supplied to the module by the module
+ manager when the module is created and started. */
+
+extern ALIGN_TYPE (*_txm_module_kernel_call_dispatcher)(ULONG type, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param3);
+
+
+/* Define specific module function prototypes. */
+
+#define txm_module_application_request _txm_module_application_request
+#define txm_module_object_allocate _txm_module_object_allocate
+#define txm_module_object_deallocate _txm_module_object_deallocate
+#define txm_module_object_pointer_get _txm_module_object_pointer_get
+#define txm_module_object_pointer_get_extended _txm_module_object_pointer_get_extended
+
+VOID _txm_module_thread_shell_entry(TX_THREAD *thread_ptr, TXM_MODULE_THREAD_ENTRY_INFO *thread_info);
+UINT _txm_module_thread_system_suspend(TX_THREAD *thread_ptr);
+
+UINT _txm_module_application_request(ULONG request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3);
+UINT _txm_module_object_allocate(VOID **object_ptr, ULONG object_size);
+UINT _txm_module_object_deallocate(VOID *object_ptr);
+UINT _txm_module_object_pointer_get(UINT object_type, CHAR *name, VOID **object_ptr);
+UINT _txm_module_object_pointer_get_extended(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+
+/* Module callback functions. */
+
+#ifdef TXM_MODULE_ENABLE_NETX
+VOID _txm_module_netx_callback_request(TXM_MODULE_CALLBACK_MESSAGE *callback_message);
+#endif
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+VOID _txm_module_netxduo_callback_request(TXM_MODULE_CALLBACK_MESSAGE *callback_message);
+#endif
+#ifdef TXM_MODULE_ENABLE_FILEX
+VOID _txm_module_filex_callback_request(TXM_MODULE_CALLBACK_MESSAGE *callback_message);
+#endif
+#ifdef TXM_MODULE_ENABLE_GUIX
+VOID _txm_module_guix_duo_callback_request(TXM_MODULE_CALLBACK_MESSAGE *callback_message);
+#endif
+#ifdef TXM_MODULE_ENABLE_USBX
+VOID _txm_module_usbx_duo_callback_request(TXM_MODULE_CALLBACK_MESSAGE *callback_message);
+#endif
+
+/* Define the module's thread shell entry function macros. */
+
+#define TXM_THREAD_COMPLETED_EXTENSION(a)
+#define TXM_THREAD_STATE_CHANGE(a, b)
+
+#else
+
+
+/* Map the module manager APIs just in case this is being included from the module manager in the
+ resident portion of the application. */
+
+#define txm_module_manager_initialize _txm_module_manager_initialize
+#define txm_module_manager_in_place_load _txm_module_manager_in_place_load
+#define txm_module_manager_file_load _txm_module_manager_file_load
+#define txm_module_manager_memory_load _txm_module_manager_memory_load
+#define txm_module_manager_object_pointer_get _txm_module_manager_object_pointer_get
+#define txm_module_manager_object_pointer_get_extended _txm_module_manager_object_pointer_get_extended
+#define txm_module_manager_object_pool_create _txm_module_manager_object_pool_create
+#define txm_module_manager_properties_get _txm_module_manager_properties_get
+#define txm_module_manager_start _txm_module_manager_start
+#define txm_module_manager_stop _txm_module_manager_stop
+#define txm_module_manager_unload _txm_module_manager_unload
+#define txm_module_manager_maximum_module_priority_set _txm_module_manager_maximum_module_priority_set
+#define txm_module_manager_external_memory_enable _txm_module_manager_external_memory_enable
+
+/* Define external variables used by module manager functions. */
+
+#ifndef TX_MODULE_MANAGER_INIT
+extern ULONG _txm_module_manager_properties_supported;
+extern ULONG _txm_module_manager_properties_required;
+extern TX_BYTE_POOL _txm_module_manager_byte_pool;
+extern TX_BYTE_POOL _txm_module_manager_object_pool;
+extern UINT _txm_module_manager_object_pool_created;
+extern TXM_MODULE_INSTANCE *_txm_module_manager_loaded_list_ptr;
+extern ULONG _txm_module_manger_loaded_count;
+extern UINT _txm_module_manager_ready;
+extern TX_MUTEX _txm_module_manager_mutex;
+extern ULONG _txm_module_manager_callback_total_count;
+extern ULONG _txm_module_manager_callback_error_count;
+#endif
+
+/* Define internal module manager function prototypes. */
+
+UINT _txm_module_manager_application_request(ULONG request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3);
+#ifdef FX_FILEX_PRESENT
+UINT _txm_module_manager_file_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, FX_MEDIA *media_ptr, CHAR *file_name);
+#endif
+UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_memory_size);
+UINT _txm_module_manager_in_place_load(TXM_MODULE_INSTANCE *module_instance, CHAR *name, VOID *module_location);
+UINT _txm_module_manager_internal_load(TXM_MODULE_INSTANCE *module_instance, CHAR *name, VOID *module_location,
+ ULONG code_size, VOID *code_allocation_ptr, ULONG code_allocation_size);
+ALIGN_TYPE _txm_module_manager_kernel_dispatch(ULONG kernel_request, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2);
+UINT _txm_module_manager_object_allocate(VOID **object_ptr_ptr, ULONG object_size, TXM_MODULE_INSTANCE *module_instance);
+UINT _txm_module_manager_object_deallocate(VOID *object_ptr);
+UINT _txm_module_manager_object_pointer_get(UINT object_type, CHAR *name, VOID **object_ptr);
+UINT _txm_module_manager_object_pointer_get_extended(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+UINT _txm_module_manager_object_pool_create(VOID *object_memory, ULONG object_memory_size);
+VOID _txm_module_manager_object_type_set(ULONG object_ptr, ULONG object_size, ULONG object_type);
+UINT _txm_module_manager_memory_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location);
+UINT _txm_module_manager_properties_get(TXM_MODULE_INSTANCE *module_instance, ULONG *module_properties_ptr);
+UINT _txm_module_manager_start(TXM_MODULE_INSTANCE *module_instance);
+UINT _txm_module_manager_stop(TXM_MODULE_INSTANCE *module_instance);
+UINT _txm_module_manager_thread_create(TX_THREAD *thread_ptr, CHAR *name, VOID (*shell_function)(TX_THREAD *, TXM_MODULE_INSTANCE *),
+ VOID (*entry_function)(ULONG), ULONG entry_input,
+ VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
+ ULONG time_slice, UINT auto_start, UINT thread_control_block_size, TXM_MODULE_INSTANCE *module_instance);
+UINT _txm_module_manager_thread_reset(TX_THREAD *thread_ptr);
+VOID _txm_module_manager_name_build(CHAR *module_name, CHAR *thread_name, CHAR *combined_name);
+VOID _txm_module_manager_thread_stack_build(TX_THREAD *thread_ptr, VOID (*shell_function)(TX_THREAD *, TXM_MODULE_INSTANCE *));
+UINT _txm_module_manager_unload(TXM_MODULE_INSTANCE *module_instance);
+ALIGN_TYPE _txm_module_manager_user_mode_entry(ULONG kernel_request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3);
+UINT _txm_module_manager_maximum_module_priority_set(TXM_MODULE_INSTANCE *module_instance, UINT priority);
+UINT _txm_module_manager_external_memory_enable(TXM_MODULE_INSTANCE *module_instance, VOID *start_address, ULONG length, UINT attributes);
+
+#ifdef TXM_MODULE_ENABLE_NETX
+ULONG _txm_module_manager_netx_dispatch(TXM_MODULE_INSTANCE *module_instance, ULONG kernel_request, ULONG param_1, ULONG param_2, ULONG param_3);
+UINT _txm_module_manager_netx_object_pointer_get(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+ALIGN_TYPE _txm_module_manager_netxduo_dispatch(TXM_MODULE_INSTANCE *module_instance, ULONG kernel_request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3);
+UINT _txm_module_manager_netxduo_object_pointer_get(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+ALIGN_TYPE _txm_module_manager_filex_dispatch(TXM_MODULE_INSTANCE *module_instance, ULONG kernel_request, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2);
+UINT _txm_module_manager_filex_object_pointer_get(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+ULONG _txm_module_manager_guix_dispatch(TXM_MODULE_INSTANCE *module_instance, ULONG kernel_request, ULONG param_1, ULONG param_2, ULONG param_3);
+UINT _txm_module_manager_guix_object_pointer_get(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+ULONG _txm_module_manager_usbx_dispatch(TXM_MODULE_INSTANCE *module_instance, ULONG kernel_request, ULONG param_1, ULONG param_2, ULONG param_3);
+UINT _txm_module_manager_usbx_object_pointer_get(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr);
+#endif
+
+/* Define the callback deferred processing routines necessary for executing callbacks in the module code. */
+
+VOID _txm_module_manager_callback_request(TX_QUEUE *module_callback_queue, TXM_MODULE_CALLBACK_MESSAGE *callback_request);
+VOID _txm_module_manager_event_flags_notify_trampoline(TX_EVENT_FLAGS_GROUP *group_ptr);
+VOID _txm_module_manager_queue_notify_trampoline(TX_QUEUE *queue_ptr);
+VOID _txm_module_manager_semaphore_notify_trampoline(TX_SEMAPHORE *semaphore_ptr);
+VOID _txm_module_manager_thread_notify_trampoline(TX_THREAD *thread_ptr, UINT type);
+VOID _txm_module_manager_timer_notify_trampoline(ULONG id);
+
+
+/* Define port specific module manager prototypes. */
+
+TXM_MODULE_MANAGER_ADDITIONAL_PROTOTYPES
+
+#endif
+
+
+/* Determine if a C++ compiler is being used. If so, complete the standard
+ C conditional started above. */
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
diff --git a/common_modules/inc/txm_module_user.h b/common_modules/inc/txm_module_user.h
new file mode 100644
index 00000000..b6cf1788
--- /dev/null
+++ b/common_modules/inc/txm_module_user.h
@@ -0,0 +1,60 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** User Specific */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/**************************************************************************/
+/* */
+/* APPLICATION INTERFACE DEFINITION RELEASE */
+/* */
+/* txm_module_user.h PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file contains user defines for configuring the Module Manager */
+/* in specific ways. This file will have an effect only if the Module */
+/* Manager library is built with TXM_MODULE_INCLUDE_USER_DEFINE_FILE */
+/* defined. Note that all the defines in this file may also be made on */
+/* the command line when building Modules library and application */
+/* objects. */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+
+#ifndef TXM_MODULE_USER_H
+#define TXM_MODULE_USER_H
+
+/* Defines the kernel stack size for a module thread. The default is 512, which is
+ sufficient for applications only using ThreadX, however, if other libraries are
+ used i.e. FileX, NetX, etc., then this value will most likely need to be increased. */
+
+/* #define TXM_MODULE_KERNEL_STACK_SIZE 2048 */
+
+#endif
diff --git a/common_modules/module_lib/src/txm_block_allocate.c b/common_modules/module_lib/src/txm_block_allocate.c
new file mode 100644
index 00000000..9c1e1054
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_allocate.c
@@ -0,0 +1,80 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_block_allocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the allocate block memory */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* block_ptr Pointer to place allocated block */
+/* pointer */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid pool pointer */
+/* TX_PTR_ERROR Invalid destination pointer */
+/* TX_WAIT_ERROR Invalid wait option */
+/* status Actual Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_ALLOCATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) block_ptr, (ALIGN_TYPE) wait_option);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_create.c b/common_modules/module_lib/src/txm_block_pool_create.c
new file mode 100644
index 00000000..897a863e
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_create.c
@@ -0,0 +1,89 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_block_pool_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the create block memory pool */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* name_ptr Pointer to block pool name */
+/* block_size Number of bytes in each block */
+/* pool_start Address of beginning of pool area */
+/* pool_size Number of bytes in the block pool */
+/* pool_control_block_size Size of block pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid pool pointer */
+/* TX_PTR_ERROR Invalid starting address */
+/* TX_SIZE_ERROR Invalid pool size */
+/* TX_CALLER_ERROR Invalid caller of pool */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) block_size;
+ extra_parameters[1] = (ALIGN_TYPE) pool_start;
+ extra_parameters[2] = (ALIGN_TYPE) pool_size;
+ extra_parameters[3] = (ALIGN_TYPE) pool_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_CREATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_delete.c b/common_modules/module_lib/src/txm_block_pool_delete.c
new file mode 100644
index 00000000..9b0436eb
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_block_pool_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the delete block pool memory */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid memory block pool pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual delete function status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_DELETE_CALL, (ALIGN_TYPE) pool_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_info_get.c b/common_modules/module_lib/src/txm_block_pool_info_get.c
new file mode 100644
index 00000000..40489186
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_block_pool_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the block pool information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to block pool control blk */
+/* name Destination for the pool name */
+/* available_blocks Number of free blocks in pool */
+/* total_blocks Total number of blocks in pool */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on block pool */
+/* suspended_count Destination for suspended count */
+/* next_pool Destination for pointer to next */
+/* block pool on the created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid block pool pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) available_blocks;
+ extra_parameters[1] = (ALIGN_TYPE) total_blocks;
+ extra_parameters[2] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[3] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[4] = (ALIGN_TYPE) next_pool;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_INFO_GET_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_performance_info_get.c b/common_modules/module_lib/src/txm_block_pool_performance_info_get.c
new file mode 100644
index 00000000..7441e4aa
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_performance_info_get.c
@@ -0,0 +1,87 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_block_pool_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* block pool. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to block pool control blk */
+/* allocates Destination for the number of */
+/* allocations from this pool */
+/* releases Destination for the number of */
+/* blocks released back to pool */
+/* suspensions Destination for number of */
+/* suspensions on this pool */
+/* timeouts Destination for number of timeouts*/
+/* on this pool */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) releases;
+ extra_parameters[1] = (ALIGN_TYPE) suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) allocates, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_performance_system_info_get.c b/common_modules/module_lib/src/txm_block_pool_performance_system_info_get.c
new file mode 100644
index 00000000..d37da4e8
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_performance_system_info_get.c
@@ -0,0 +1,84 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_block_pool_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves block pool performance information. */
+/* */
+/* INPUT */
+/* */
+/* allocates Destination for the total number */
+/* of block allocations */
+/* releases Destination for the total number */
+/* of blocks released */
+/* suspensions Destination for the total number */
+/* of suspensions */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_block_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) allocates, (ALIGN_TYPE) releases, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_pool_prioritize.c b/common_modules/module_lib/src/txm_block_pool_prioritize.c
new file mode 100644
index 00000000..05c2bbd8
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_pool_prioritize.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_block_pool_prioritize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the block pool prioritize call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_PRIORITIZE_CALL, (ALIGN_TYPE) pool_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_block_release.c b/common_modules/module_lib/src/txm_block_release.c
new file mode 100644
index 00000000..2b644943
--- /dev/null
+++ b/common_modules/module_lib/src/txm_block_release.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_block_release PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the block release function call. */
+/* */
+/* INPUT */
+/* */
+/* block_ptr Pointer to memory block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_PTR_ERROR Invalid memory block pointer */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_block_release(VOID *block_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_RELEASE_CALL, (ALIGN_TYPE) block_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_allocate.c b/common_modules/module_lib/src/txm_byte_allocate.c
new file mode 100644
index 00000000..bf9da24d
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_allocate.c
@@ -0,0 +1,86 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_byte_allocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in allocate bytes function call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* memory_ptr Pointer to place allocated bytes */
+/* pointer */
+/* memory_size Number of bytes to allocate */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid memory pool pointer */
+/* TX_PTR_ERROR Invalid destination pointer */
+/* TX_WAIT_ERROR Invalid wait option */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* TX_SIZE_ERROR Invalid size of memory request */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, ULONG wait_option)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) memory_size;
+ extra_parameters[1] = (ALIGN_TYPE) wait_option;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_ALLOCATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) memory_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_create.c b/common_modules/module_lib/src/txm_byte_pool_create.c
new file mode 100644
index 00000000..c2b02c0b
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_create.c
@@ -0,0 +1,87 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_byte_pool_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the create byte pool memory */
+/* function. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* name_ptr Pointer to byte pool name */
+/* pool_start Address of beginning of pool area */
+/* pool_size Number of bytes in the byte pool */
+/* pool_control_block_size Size of byte pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid byte pool pointer */
+/* TX_PTR_ERROR Invalid pool starting address */
+/* TX_SIZE_ERROR Invalid pool size */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) pool_start;
+ extra_parameters[1] = (ALIGN_TYPE) pool_size;
+ extra_parameters[2] = (ALIGN_TYPE) pool_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_CREATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_delete.c b/common_modules/module_lib/src/txm_byte_pool_delete.c
new file mode 100644
index 00000000..5616cfb4
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_byte_pool_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the delete byte pool function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid pool pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_DELETE_CALL, (ALIGN_TYPE) pool_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_info_get.c b/common_modules/module_lib/src/txm_byte_pool_info_get.c
new file mode 100644
index 00000000..2ff97682
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_byte_pool_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the byte pool information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to byte pool control block*/
+/* name Destination for the pool name */
+/* available_bytes Number of free bytes in byte pool */
+/* fragments Number of fragments in byte pool */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on byte pool */
+/* suspended_count Destination for suspended count */
+/* next_pool Destination for pointer to next */
+/* byte pool on the created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_POOL_ERROR Invalid byte pool pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) available_bytes;
+ extra_parameters[1] = (ALIGN_TYPE) fragments;
+ extra_parameters[2] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[3] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[4] = (ALIGN_TYPE) next_pool;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_INFO_GET_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_performance_info_get.c b/common_modules/module_lib/src/txm_byte_pool_performance_info_get.c
new file mode 100644
index 00000000..2ac466b7
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_performance_info_get.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_byte_pool_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* byte pool. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to byte pool control block*/
+/* allocates Destination for number of */
+/* allocates on this pool */
+/* releases Destination for number of */
+/* releases on this pool */
+/* fragments_searched Destination for number of */
+/* fragments searched during */
+/* allocation */
+/* merges Destination for number of adjacent*/
+/* free fragments merged */
+/* splits Destination for number of */
+/* fragments split during */
+/* allocation */
+/* suspensions Destination for number of */
+/* suspensions on this pool */
+/* timeouts Destination for number of timeouts*/
+/* on this byte pool */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases, ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[6];
+
+ extra_parameters[0] = (ALIGN_TYPE) releases;
+ extra_parameters[1] = (ALIGN_TYPE) fragments_searched;
+ extra_parameters[2] = (ALIGN_TYPE) merges;
+ extra_parameters[3] = (ALIGN_TYPE) splits;
+ extra_parameters[4] = (ALIGN_TYPE) suspensions;
+ extra_parameters[5] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) allocates, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_performance_system_info_get.c b/common_modules/module_lib/src/txm_byte_pool_performance_system_info_get.c
new file mode 100644
index 00000000..3b3b8b59
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_performance_system_info_get.c
@@ -0,0 +1,95 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_byte_pool_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves byte pool performance information. */
+/* */
+/* INPUT */
+/* */
+/* allocates Destination for total number of */
+/* allocates */
+/* releases Destination for total number of */
+/* releases */
+/* fragments_searched Destination for total number of */
+/* fragments searched during */
+/* allocation */
+/* merges Destination for total number of */
+/* adjacent free fragments merged */
+/* splits Destination for total number of */
+/* fragments split during */
+/* allocation */
+/* suspensions Destination for total number of */
+/* suspensions */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_byte_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) fragments_searched;
+ extra_parameters[1] = (ALIGN_TYPE) merges;
+ extra_parameters[2] = (ALIGN_TYPE) splits;
+ extra_parameters[3] = (ALIGN_TYPE) suspensions;
+ extra_parameters[4] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) allocates, (ALIGN_TYPE) releases, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_pool_prioritize.c b/common_modules/module_lib/src/txm_byte_pool_prioritize.c
new file mode 100644
index 00000000..94dfa607
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_pool_prioritize.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_byte_pool_prioritize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the byte pool prioritize call. */
+/* */
+/* INPUT */
+/* */
+/* pool_ptr Pointer to pool control block */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_POOL_PRIORITIZE_CALL, (ALIGN_TYPE) pool_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_byte_release.c b/common_modules/module_lib/src/txm_byte_release.c
new file mode 100644
index 00000000..31b32848
--- /dev/null
+++ b/common_modules/module_lib/src/txm_byte_release.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_byte_release PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the release byte function call. */
+/* */
+/* INPUT */
+/* */
+/* memory_ptr Pointer to allocated memory */
+/* */
+/* OUTPUT */
+/* */
+/* TX_PTR_ERROR Invalid memory pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_byte_release(VOID *memory_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_RELEASE_CALL, (ALIGN_TYPE) memory_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_create.c b/common_modules/module_lib/src/txm_event_flags_create.c
new file mode 100644
index 00000000..a0ae4eb6
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_create.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the event flag creation function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to event flags group */
+/* control block */
+/* name_ptr Pointer to event flags name */
+/* event_control_block_size Size of event flags control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_GROUP_ERROR Invalid event flag group pointer */
+/* TX_CALLER_ERROR Invalid calling function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_CREATE_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) event_control_block_size);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_delete.c b/common_modules/module_lib/src/txm_event_flags_delete.c
new file mode 100644
index 00000000..fccb74b0
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the delete event flags group */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to group control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_GROUP_ERROR Invalid event flag group pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_DELETE_CALL, (ALIGN_TYPE) group_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_get.c b/common_modules/module_lib/src/txm_event_flags_get.c
new file mode 100644
index 00000000..792826d5
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_get.c
@@ -0,0 +1,89 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the event flags get function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to group control block */
+/* requested_event_flags Event flags requested */
+/* get_option Specifies and/or and clear options*/
+/* actual_flags_ptr Pointer to place the actual flags */
+/* the service retrieved */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_GROUP_ERROR Invalid event flags group pointer */
+/* TX_PTR_ERROR Invalid actual flags pointer */
+/* TX_WAIT_ERROR Invalid wait option */
+/* TX_OPTION_ERROR Invalid get option */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) get_option;
+ extra_parameters[1] = (ALIGN_TYPE) actual_flags_ptr;
+ extra_parameters[2] = (ALIGN_TYPE) wait_option;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_GET_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) requested_flags, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_info_get.c b/common_modules/module_lib/src/txm_event_flags_info_get.c
new file mode 100644
index 00000000..5242503e
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the event flag information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to event flag group */
+/* name Destination for the event flags */
+/* group name */
+/* current_flags Current event flags */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on event flags */
+/* suspended_count Destination for suspended count */
+/* next_group Destination for pointer to next */
+/* event flag group on the created */
+/* list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_GROUP_ERROR Invalid event flag group pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) current_flags;
+ extra_parameters[1] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[2] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[3] = (ALIGN_TYPE) next_group;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_INFO_GET_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_performance_info_get.c b/common_modules/module_lib/src/txm_event_flags_performance_info_get.c
new file mode 100644
index 00000000..dfc6b0fa
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_performance_info_get.c
@@ -0,0 +1,88 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_event_flags_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* event flag group. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to event flag group */
+/* sets Destination for the number of */
+/* event flag sets on this group */
+/* gets Destination for the number of */
+/* event flag gets on this group */
+/* suspensions Destination for the number of */
+/* event flag suspensions on this */
+/* group */
+/* timeouts Destination for number of timeouts*/
+/* on this event flag group */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) gets;
+ extra_parameters[1] = (ALIGN_TYPE) suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) sets, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_performance_system_info_get.c b/common_modules/module_lib/src/txm_event_flags_performance_system_info_get.c
new file mode 100644
index 00000000..840f2d00
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_performance_system_info_get.c
@@ -0,0 +1,84 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_event_flags_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves system event flag performance information. */
+/* */
+/* INPUT */
+/* */
+/* sets Destination for total number of */
+/* event flag sets */
+/* gets Destination for total number of */
+/* event flag gets */
+/* suspensions Destination for total number of */
+/* event flag suspensions */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) sets, (ALIGN_TYPE) gets, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_set.c b/common_modules/module_lib/src/txm_event_flags_set.c
new file mode 100644
index 00000000..182e4eed
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_set.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_set PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the set event flags function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to group control block */
+/* flags_to_set Event flags to set */
+/* set_option Specified either AND or OR */
+/* operation on the event flags */
+/* */
+/* OUTPUT */
+/* */
+/* TX_GROUP_ERROR Invalid event flags group pointer */
+/* TX_OPTION_ERROR Invalid set option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_SET_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) flags_to_set, (ALIGN_TYPE) set_option);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_event_flags_set_notify.c b/common_modules/module_lib/src/txm_event_flags_set_notify.c
new file mode 100644
index 00000000..99816859
--- /dev/null
+++ b/common_modules/module_lib/src/txm_event_flags_set_notify.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_event_flags_set_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the event flags set notify */
+/* callback function call. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Pointer to group control block*/
+/* group_put_notify Application callback function */
+/* (TX_NULL disables notify) */
+/* */
+/* OUTPUT */
+/* */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_EVENT_FLAGS_SET_NOTIFY_CALL, (ALIGN_TYPE) group_ptr, (ALIGN_TYPE) events_set_notify, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_module_application_request.c b/common_modules/module_lib/src/txm_module_application_request.c
new file mode 100644
index 00000000..8e397c89
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_application_request.c
@@ -0,0 +1,78 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* txm_module_application_request PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sends an application-specific request to the resident */
+/* code. */
+/* */
+/* INPUT */
+/* */
+/* request Request ID (application defined) */
+/* param_1 First parameter */
+/* param_2 Second parameter */
+/* param_3 Third parameter */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT txm_module_application_request(ULONG request, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT)(_txm_module_kernel_call_dispatcher)(TXM_APPLICATION_REQUEST_ID_BASE+request, param_1, param_2, param_3);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
+
diff --git a/common_modules/module_lib/src/txm_module_callback_request_thread_entry.c b/common_modules/module_lib/src/txm_module_callback_request_thread_entry.c
new file mode 100644
index 00000000..e8ba684d
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_callback_request_thread_entry.c
@@ -0,0 +1,244 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#ifndef TXM_MODULE
+#define TXM_MODULE
+#endif
+
+#ifndef TX_SOURCE_CODE
+#define TX_SOURCE_CODE
+#endif
+
+
+/* Include necessary system files. */
+
+#include "txm_module.h"
+#include "tx_queue.h"
+
+
+/* Define the global module entry pointer from the start thread of the module.
+ This structure contains the pointer to the request queue as well as the
+ pointer to the callback response queue. */
+
+extern TXM_MODULE_THREAD_ENTRY_INFO *_txm_module_entry_info;
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_callback_request_thread_entry PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes all module callback requests, transferred */
+/* by the resident code via the callback queue. When the callback is */
+/* complete, the response is sent back to the resident code to */
+/* acknowledge it. */
+/* */
+/* INPUT */
+/* */
+/* id Module thread ID */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* tx_queue_receive Receive callback request */
+/* */
+/* CALLED BY */
+/* */
+/* Initial thread stack frame */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_callback_request_thread_entry(ULONG id)
+{
+
+TX_QUEUE *request_queue;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+ULONG activation_count;
+VOID (*timer_callback)(ULONG);
+VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *);
+VOID (*semaphore_put_notify)(TX_SEMAPHORE *);
+VOID (*queue_send_notify)(TX_QUEUE *);
+VOID (*thread_entry_exit_notify)(TX_THREAD *, UINT);
+UINT status;
+
+
+ /* Pickup pointer to the request queue. */
+ request_queue = _txm_module_entry_info -> txm_module_thread_entry_info_callback_request_queue;
+
+ /* Loop to process callback messages from the module manager. */
+ while(1)
+ {
+
+ /* Wait for the callback request for the module. */
+ status = _txe_queue_receive(request_queue, (VOID *) &callback_message, TX_WAIT_FOREVER);
+
+ /* Check to see if a request was received. */
+ if (status != TX_SUCCESS)
+ {
+
+ /* This should not happen - get out of the loop. */
+ break;
+ }
+
+ /* Pickup the activation count in the message. */
+ activation_count = callback_message.txm_module_callback_message_activation_count;
+
+ /* Loop to call the callback function the correct number of times. */
+ while (activation_count)
+ {
+
+ /* Decrement the activation count. */
+ activation_count--;
+
+ /* Now dispatch the callback function. */
+ switch (callback_message.txm_module_callback_message_type)
+ {
+
+ case TXM_TIMER_CALLBACK:
+
+ /* Setup timer callback pointer. */
+ timer_callback = (void (*)(ULONG)) callback_message.txm_module_callback_message_application_function;
+
+ /* Call application's timer callback. */
+ (timer_callback)((ULONG) callback_message.txm_module_callback_message_param_1);
+
+ break;
+
+ case TXM_EVENTS_SET_CALLBACK:
+
+ /* Setup events set callback pointer. */
+ events_set_notify = (void (*)(TX_EVENT_FLAGS_GROUP *)) callback_message.txm_module_callback_message_application_function;
+
+ /* Call events set notify callback. */
+ (events_set_notify)((TX_EVENT_FLAGS_GROUP *) callback_message.txm_module_callback_message_param_1);
+
+ break;
+
+ case TXM_QUEUE_SEND_CALLBACK:
+
+ /* Setup queue send callback pointer. */
+ queue_send_notify = (void (*)(TX_QUEUE *)) callback_message.txm_module_callback_message_application_function;
+
+ /* Call queue send notify callback. */
+ (queue_send_notify)((TX_QUEUE *) callback_message.txm_module_callback_message_param_1);
+
+ break;
+
+ case TXM_SEMAPHORE_PUT_CALLBACK:
+
+ /* Setup semaphore put callback pointer. */
+ semaphore_put_notify = (void (*)(TX_SEMAPHORE *)) callback_message.txm_module_callback_message_application_function;
+
+ /* Call semaphore put notify callback. */
+ (semaphore_put_notify)((TX_SEMAPHORE *) callback_message.txm_module_callback_message_param_1);
+
+ break;
+
+ case TXM_THREAD_ENTRY_EXIT_CALLBACK:
+
+ /* Setup thread entry/exit callback pointer. */
+ thread_entry_exit_notify = (void (*)(TX_THREAD *, UINT)) callback_message.txm_module_callback_message_application_function;
+
+ /* Call thread entry/exit notify callback. */
+ (thread_entry_exit_notify)((TX_THREAD *) callback_message.txm_module_callback_message_param_1, (UINT) callback_message.txm_module_callback_message_param_2);
+
+ break;
+
+ default:
+
+#ifdef TXM_MODULE_ENABLE_NETX
+
+ /* Determine if there is a NetX callback. */
+ if ((callback_message.txm_module_callback_message_type >= TXM_NETX_CALLBACKS_START) && (callback_message.txm_module_callback_message_type < TXM_NETX_CALLBACKS_END))
+ {
+
+ /* Call the NetX module callback function. */
+ _txm_module_netx_callback_request(&callback_message);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+
+ /* Determine if there is a NetX Duo callback. */
+ if ((callback_message.txm_module_callback_message_type >= TXM_NETXDUO_CALLBACKS_START) && (callback_message.txm_module_callback_message_type < TXM_NETXDUO_CALLBACKS_END))
+ {
+
+ /* Call the NetX Duo module callback function. */
+ _txm_module_netxduo_callback_request(&callback_message);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+
+ /* Determine if there is a FileX callback. */
+ if ((callback_message.txm_module_callback_message_type >= TXM_FILEX_CALLBACKS_START) && (callback_message.txm_module_callback_message_type < TXM_FILEX_CALLBACKS_END))
+ {
+
+ /* Call the FileX module callback function. */
+ _txm_module_filex_callback_request(&callback_message);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+
+ /* Determine if there is a GUIX callback. */
+ if ((callback_message.txm_module_callback_message_type >= TXM_GUIX_CALLBACKS_START) && (callback_message.txm_module_callback_message_type < TXM_GUIX_CALLBACKS_END))
+ {
+
+ /* Call the GUIX module callback function. */
+ _txm_module_guix_callback_request(&callback_message);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+
+ /* Determine if there is a USBX callback. */
+ if ((callback_message.txm_module_callback_message_type >= TXM_USBX_CALLBACKS_START) && (callback_message.txm_module_callback_message_type < TXM_USBX_CALLBACKS_END))
+ {
+
+ /* Call the USBX callback function. */
+ _txm_module_usbx_callback_request(&callback_message);
+ }
+#endif
+
+ break;
+ }
+ }
+ }
+}
+
+
diff --git a/common_modules/module_lib/src/txm_module_object_allocate.c b/common_modules/module_lib/src/txm_module_object_allocate.c
new file mode 100644
index 00000000..3ae4c91f
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_object_allocate.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_allocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function allocates memory for an object from the memory pool */
+/* supplied to txm_module_manager_initialize. */
+/* */
+/* INPUT */
+/* */
+/* object_ptr Destination of object pointer on */
+/* successful allocation */
+/* object_size Size in bytes of the object to be */
+/* allocated */
+/* module_instance The module instance that the */
+/* object belongs to */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_object_allocate(VOID **object_ptr, ULONG object_size)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_ALLOCATE_CALL, (ALIGN_TYPE) object_ptr, (ALIGN_TYPE) object_size, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_module_object_deallocate.c b/common_modules/module_lib/src/txm_module_object_deallocate.c
new file mode 100644
index 00000000..e3e39bb8
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_object_deallocate.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_deallocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function deallocates a previously allocated object. */
+/* */
+/* INPUT */
+/* */
+/* object_ptr Object pointer to deallocate */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_object_deallocate(VOID *object_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_DEALLOCATE_CALL, (ALIGN_TYPE) object_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_module_object_pointer_get.c b/common_modules/module_lib/src/txm_module_object_pointer_get.c
new file mode 100644
index 00000000..81e5fd9b
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_object_pointer_get.c
@@ -0,0 +1,89 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_pointer_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is deprecated and calls the secure version of this */
+/* function (_txm_module_manager_object_pointer_get_extended) with the */
+/* maximum possible name length since none was passed. */
+/* */
+/* INPUT */
+/* */
+/* object_type Type of object, as follows: */
+/* */
+/* TXM_BLOCK_POOL_OBJECT */
+/* TXM_BYTE_POOL_OBJECT */
+/* TXM_EVENT_FLAGS_OBJECT */
+/* TXM_MUTEX_OBJECT */
+/* TXM_QUEUE_OBJECT */
+/* TXM_SEMAPHORE_OBJECT */
+/* TXM_THREAD_OBJECT */
+/* TXM_TIMER_OBJECT */
+/* name Name to search for */
+/* object_ptr Pointer to the object */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SUCCESS Successful completion */
+/* TX_PTR_ERROR Invalid name or object ptr */
+/* TX_OPTION_ERROR Invalid option type */
+/* TX_NO_INSTANCE Object not found */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_object_pointer_get(UINT object_type, CHAR *name, VOID **object_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_POINTER_GET_CALL, (ALIGN_TYPE) object_type, (ALIGN_TYPE) name, (ALIGN_TYPE) object_ptr);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_module_object_pointer_get_extended.c b/common_modules/module_lib/src/txm_module_object_pointer_get_extended.c
new file mode 100644
index 00000000..987de28a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_object_pointer_get_extended.c
@@ -0,0 +1,96 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_pointer_get_extended PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves the object pointer of a particular type */
+/* with a particular name. If the object is not found, an error is */
+/* returned. Otherwise, if the object is found, the address of that */
+/* object is placed in object_ptr. */
+/* */
+/* INPUT */
+/* */
+/* object_type Type of object, as follows: */
+/* */
+/* TXM_BLOCK_POOL_OBJECT */
+/* TXM_BYTE_POOL_OBJECT */
+/* TXM_EVENT_FLAGS_OBJECT */
+/* TXM_MUTEX_OBJECT */
+/* TXM_QUEUE_OBJECT */
+/* TXM_SEMAPHORE_OBJECT */
+/* TXM_THREAD_OBJECT */
+/* TXM_TIMER_OBJECT */
+/* name Name to search for */
+/* name_length Length of the name excluding */
+/* null-terminator */
+/* object_ptr Pointer to the object */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SUCCESS Successful completion */
+/* TX_PTR_ERROR Invalid name or object ptr */
+/* TX_OPTION_ERROR Invalid option type */
+/* TX_NO_INSTANCE Object not found */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_object_pointer_get_extended(UINT object_type, CHAR *name, UINT name_length, VOID **object_ptr)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) name_length;
+ extra_parameters[1] = (ALIGN_TYPE) object_ptr;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_POINTER_GET_EXTENDED_CALL, (ALIGN_TYPE) object_type, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_module_thread_system_suspend.c b/common_modules/module_lib/src/txm_module_thread_system_suspend.c
new file mode 100644
index 00000000..a94d3863
--- /dev/null
+++ b/common_modules/module_lib/src/txm_module_thread_system_suspend.c
@@ -0,0 +1,81 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_system_suspend PORTABLE C */
+/* 6.0.1 */
+/* */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function suspends the specified thread and changes the thread */
+/* state to the value specified. Note: delayed suspension processing */
+/* is handled outside of this routine. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to suspend */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* _tx_thread_priority_change Thread priority change */
+/* _tx_thread_shell_entry Thread shell function */
+/* _tx_thread_sleep Thread sleep */
+/* _tx_thread_suspend Application thread suspend */
+/* _tx_thread_terminate Thread terminate */
+/* Other ThreadX Components */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_thread_system_suspend(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_SYSTEM_SUSPEND_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_create.c b/common_modules/module_lib/src/txm_mutex_create.c
new file mode 100644
index 00000000..458b964e
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_create.c
@@ -0,0 +1,84 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_mutex_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the create mutex function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* name_ptr Pointer to mutex name */
+/* inherit Initial mutex count */
+/* mutex_control_block_size Size of mutex control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_MUTEX_ERROR Invalid mutex pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* TX_INHERIT_ERROR Invalid inherit option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) inherit;
+ extra_parameters[1] = (ALIGN_TYPE) mutex_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_CREATE_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_delete.c b/common_modules/module_lib/src/txm_mutex_delete.c
new file mode 100644
index 00000000..4773c9c1
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_mutex_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the mutex delete function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_MUTEX_ERROR Invalid mutex pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_DELETE_CALL, (ALIGN_TYPE) mutex_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_get.c b/common_modules/module_lib/src/txm_mutex_get.c
new file mode 100644
index 00000000..2c48dacd
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_get.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_mutex_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the mutex get function call. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_MUTEX_ERROR Invalid mutex pointer */
+/* TX_WAIT_ERROR Invalid wait option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_GET_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) wait_option, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_info_get.c b/common_modules/module_lib/src/txm_mutex_info_get.c
new file mode 100644
index 00000000..9f9c45f9
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_info_get.c
@@ -0,0 +1,91 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_mutex_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the mutex information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* name Destination for the mutex name */
+/* count Destination for the owner count */
+/* owner Destination for the owner's */
+/* thread control block pointer */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on the mutex */
+/* suspended_count Destination for suspended count */
+/* next_mutex Destination for pointer to next */
+/* mutex on the created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_MUTEX_ERROR Invalid mutex pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) count;
+ extra_parameters[1] = (ALIGN_TYPE) owner;
+ extra_parameters[2] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[3] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[4] = (ALIGN_TYPE) next_mutex;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_INFO_GET_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_performance_info_get.c b/common_modules/module_lib/src/txm_mutex_performance_info_get.c
new file mode 100644
index 00000000..4a7c518b
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_performance_info_get.c
@@ -0,0 +1,93 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_mutex_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* mutex. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* puts Destination for the number of */
+/* puts on to this mutex */
+/* gets Destination for the number of */
+/* gets on this mutex */
+/* suspensions Destination for the number of */
+/* suspensions on this mutex */
+/* timeouts Destination for number of timeouts*/
+/* on this mutex */
+/* inversions Destination for number of priority*/
+/* inversions on this mutex */
+/* inheritances Destination for number of priority*/
+/* inheritances on this mutex */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) gets;
+ extra_parameters[1] = (ALIGN_TYPE) suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) timeouts;
+ extra_parameters[3] = (ALIGN_TYPE) inversions;
+ extra_parameters[4] = (ALIGN_TYPE) inheritances;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) puts, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_performance_system_info_get.c b/common_modules/module_lib/src/txm_mutex_performance_system_info_get.c
new file mode 100644
index 00000000..09df71e3
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_performance_system_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_mutex_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves system mutex performance information. */
+/* */
+/* INPUT */
+/* */
+/* puts Destination for total number of */
+/* mutex puts */
+/* gets Destination for total number of */
+/* mutex gets */
+/* suspensions Destination for total number of */
+/* mutex suspensions */
+/* timeouts Destination for total number of */
+/* mutex timeouts */
+/* inversions Destination for total number of */
+/* mutex priority inversions */
+/* inheritances Destination for total number of */
+/* mutex priority inheritances */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) timeouts;
+ extra_parameters[2] = (ALIGN_TYPE) inversions;
+ extra_parameters[3] = (ALIGN_TYPE) inheritances;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) puts, (ALIGN_TYPE) gets, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_prioritize.c b/common_modules/module_lib/src/txm_mutex_prioritize.c
new file mode 100644
index 00000000..a499ecfb
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_prioritize.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_mutex_prioritize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the mutex prioritize call. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_PRIORITIZE_CALL, (ALIGN_TYPE) mutex_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_mutex_put.c b/common_modules/module_lib/src/txm_mutex_put.c
new file mode 100644
index 00000000..b49a5ed5
--- /dev/null
+++ b/common_modules/module_lib/src/txm_mutex_put.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_mutex_put PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the mutex put function call. */
+/* */
+/* INPUT */
+/* */
+/* mutex_ptr Pointer to mutex control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_MUTEX_ERROR Invalid mutex pointer */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_mutex_put(TX_MUTEX *mutex_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_PUT_CALL, (ALIGN_TYPE) mutex_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_create.c b/common_modules/module_lib/src/txm_queue_create.c
new file mode 100644
index 00000000..ea61f29c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_create.c
@@ -0,0 +1,87 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue create function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* name_ptr Pointer to queue name */
+/* message_size Size of each queue message */
+/* queue_start Starting address of the queue area*/
+/* queue_size Number of bytes in the queue */
+/* queue_control_block_size Size of queue control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_PTR_ERROR Invalid starting address of queue */
+/* TX_SIZE_ERROR Invalid message queue size */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size, UINT queue_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) message_size;
+ extra_parameters[1] = (ALIGN_TYPE) queue_start;
+ extra_parameters[2] = (ALIGN_TYPE) queue_size;
+ extra_parameters[3] = (ALIGN_TYPE) queue_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_CREATE_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_delete.c b/common_modules/module_lib/src/txm_queue_delete.c
new file mode 100644
index 00000000..d277e3c0
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_delete.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue delete function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_delete(TX_QUEUE *queue_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_DELETE_CALL, (ALIGN_TYPE) queue_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_flush.c b/common_modules/module_lib/src/txm_queue_flush.c
new file mode 100644
index 00000000..22ba4f48
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_flush.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_flush PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue flush function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_flush(TX_QUEUE *queue_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_FLUSH_CALL, (ALIGN_TYPE) queue_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_front_send.c b/common_modules/module_lib/src/txm_queue_front_send.c
new file mode 100644
index 00000000..88b847ff
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_front_send.c
@@ -0,0 +1,78 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_front_send PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue send function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* source_ptr Pointer to message source */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_PTR_ERROR Invalid source pointer - NULL */
+/* TX_WAIT_ERROR Invalid wait option - non thread */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_FRONT_SEND_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) source_ptr, (ALIGN_TYPE) wait_option);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_info_get.c b/common_modules/module_lib/src/txm_queue_info_get.c
new file mode 100644
index 00000000..5c4147a9
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* name Destination for the queue name */
+/* enqueued Destination for enqueued count */
+/* available_storage Destination for available storage */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on this queue */
+/* suspended_count Destination for suspended count */
+/* next_queue Destination for pointer to next */
+/* queue on the created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage, TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) enqueued;
+ extra_parameters[1] = (ALIGN_TYPE) available_storage;
+ extra_parameters[2] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[3] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[4] = (ALIGN_TYPE) next_queue;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_INFO_GET_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_performance_info_get.c b/common_modules/module_lib/src/txm_queue_performance_info_get.c
new file mode 100644
index 00000000..ace108b6
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_performance_info_get.c
@@ -0,0 +1,91 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_queue_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* queue. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* messages_sent Destination for messages sent */
+/* messages_received Destination for messages received */
+/* empty_suspensions Destination for number of empty */
+/* queue suspensions */
+/* full_suspensions Destination for number of full */
+/* queue suspensions */
+/* full_errors Destination for queue full errors */
+/* returned - no suspension */
+/* timeouts Destination for number of timeouts*/
+/* on this queue */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_queue_performance_info_get(TX_QUEUE *queue_ptr, ULONG *messages_sent, ULONG *messages_received, ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[5];
+
+ extra_parameters[0] = (ALIGN_TYPE) messages_received;
+ extra_parameters[1] = (ALIGN_TYPE) empty_suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) full_suspensions;
+ extra_parameters[3] = (ALIGN_TYPE) full_errors;
+ extra_parameters[4] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) messages_sent, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_performance_system_info_get.c b/common_modules/module_lib/src/txm_queue_performance_system_info_get.c
new file mode 100644
index 00000000..78840480
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_performance_system_info_get.c
@@ -0,0 +1,90 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_queue_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves queue system performance information. */
+/* */
+/* INPUT */
+/* */
+/* messages_sent Destination for total messages */
+/* sent */
+/* messages_received Destination for total messages */
+/* received */
+/* empty_suspensions Destination for total empty */
+/* queue suspensions */
+/* full_suspensions Destination for total full */
+/* queue suspensions */
+/* full_errors Destination for total queue full */
+/* errors returned - no suspension */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received, ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) empty_suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) full_suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) full_errors;
+ extra_parameters[3] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) messages_sent, (ALIGN_TYPE) messages_received, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_prioritize.c b/common_modules/module_lib/src/txm_queue_prioritize.c
new file mode 100644
index 00000000..8d368808
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_prioritize.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_prioritize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue prioritize call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_prioritize(TX_QUEUE *queue_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_PRIORITIZE_CALL, (ALIGN_TYPE) queue_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_receive.c b/common_modules/module_lib/src/txm_queue_receive.c
new file mode 100644
index 00000000..dea6bfcd
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_receive.c
@@ -0,0 +1,80 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_receive PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue receive function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* destination_ptr Pointer to message destination */
+/* **** MUST BE LARGE ENOUGH TO */
+/* HOLD MESSAGE **** */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_PTR_ERROR Invalid destination pointer (NULL)*/
+/* TX_WAIT_ERROR Invalid wait option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_RECEIVE_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) destination_ptr, (ALIGN_TYPE) wait_option);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_send.c b/common_modules/module_lib/src/txm_queue_send.c
new file mode 100644
index 00000000..00f9b344
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_send.c
@@ -0,0 +1,78 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_send PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue send function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* source_ptr Pointer to message source */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_QUEUE_ERROR Invalid queue pointer */
+/* TX_PTR_ERROR Invalid source pointer - NULL */
+/* TX_WAIT_ERROR Invalid wait option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_SEND_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) source_ptr, (ALIGN_TYPE) wait_option);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_queue_send_notify.c b/common_modules/module_lib/src/txm_queue_send_notify.c
new file mode 100644
index 00000000..c4be8e51
--- /dev/null
+++ b/common_modules/module_lib/src/txm_queue_send_notify.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_queue_send_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the queue send notify */
+/* callback function call. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block*/
+/* queue_send_notify Application callback function */
+/* (TX_NULL disables notify) */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_SEND_NOTIFY_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) queue_send_notify, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_ceiling_put.c b/common_modules/module_lib/src/txm_semaphore_ceiling_put.c
new file mode 100644
index 00000000..1c7c5967
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_ceiling_put.c
@@ -0,0 +1,77 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_ceiling_put PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore ceiling put */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore */
+/* ceiling Maximum value of semaphore */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* TX_INVALID_CEILING Invalid semaphore ceiling */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_CEILING_PUT_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) ceiling, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_create.c b/common_modules/module_lib/src/txm_semaphore_create.c
new file mode 100644
index 00000000..31ae876a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_create.c
@@ -0,0 +1,83 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the create semaphore function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* name_ptr Pointer to semaphore name */
+/* initial_count Initial semaphore count */
+/* semaphore_control_block_size Size of semaphore control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) initial_count;
+ extra_parameters[1] = (ALIGN_TYPE) semaphore_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_CREATE_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_delete.c b/common_modules/module_lib/src/txm_semaphore_delete.c
new file mode 100644
index 00000000..7180584a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore delete function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_DELETE_CALL, (ALIGN_TYPE) semaphore_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_get.c b/common_modules/module_lib/src/txm_semaphore_get.c
new file mode 100644
index 00000000..b447d32f
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_get.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore get function call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* TX_WAIT_ERROR Invalid wait option */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_GET_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) wait_option, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_info_get.c b/common_modules/module_lib/src/txm_semaphore_info_get.c
new file mode 100644
index 00000000..7c82c619
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_info_get.c
@@ -0,0 +1,89 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* name Destination for the semaphore name*/
+/* current_value Destination for current value of */
+/* the semaphore */
+/* first_suspended Destination for pointer of first */
+/* thread suspended on semaphore */
+/* suspended_count Destination for suspended count */
+/* next_semaphore Destination for pointer to next */
+/* semaphore on the created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) current_value;
+ extra_parameters[1] = (ALIGN_TYPE) first_suspended;
+ extra_parameters[2] = (ALIGN_TYPE) suspended_count;
+ extra_parameters[3] = (ALIGN_TYPE) next_semaphore;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_INFO_GET_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_performance_info_get.c b/common_modules/module_lib/src/txm_semaphore_performance_info_get.c
new file mode 100644
index 00000000..f845afe0
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_performance_info_get.c
@@ -0,0 +1,87 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_semaphore_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* semaphore. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* puts Destination for the number of */
+/* puts on to this semaphore */
+/* gets Destination for the number of */
+/* gets on this semaphore */
+/* suspensions Destination for the number of */
+/* suspensions on this semaphore */
+/* timeouts Destination for number of timeouts*/
+/* on this semaphore */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) gets;
+ extra_parameters[1] = (ALIGN_TYPE) suspensions;
+ extra_parameters[2] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) puts, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_performance_system_info_get.c b/common_modules/module_lib/src/txm_semaphore_performance_system_info_get.c
new file mode 100644
index 00000000..f2db0a7c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_performance_system_info_get.c
@@ -0,0 +1,84 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_semaphore_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves system semaphore performance information. */
+/* */
+/* INPUT */
+/* */
+/* puts Destination for total number of */
+/* semaphore puts */
+/* gets Destination for total number of */
+/* semaphore gets */
+/* suspensions Destination for total number of */
+/* semaphore suspensions */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_semaphore_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[2];
+
+ extra_parameters[0] = (ALIGN_TYPE) suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) timeouts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) puts, (ALIGN_TYPE) gets, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_prioritize.c b/common_modules/module_lib/src/txm_semaphore_prioritize.c
new file mode 100644
index 00000000..505937d1
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_prioritize.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_semaphore_prioritize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore prioritize call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_PRIORITIZE_CALL, (ALIGN_TYPE) semaphore_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_put.c b/common_modules/module_lib/src/txm_semaphore_put.c
new file mode 100644
index 00000000..0233b166
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_put.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_put PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore put function call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore control block*/
+/* */
+/* OUTPUT */
+/* */
+/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_PUT_CALL, (ALIGN_TYPE) semaphore_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_semaphore_put_notify.c b/common_modules/module_lib/src/txm_semaphore_put_notify.c
new file mode 100644
index 00000000..7a884677
--- /dev/null
+++ b/common_modules/module_lib/src/txm_semaphore_put_notify.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_semaphore_put_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the semaphore put notify */
+/* callback function call. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Pointer to semaphore */
+/* semaphore_put_notify Application callback function */
+/* (TX_NULL disables notify) */
+/* */
+/* OUTPUT */
+/* */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_SEMAPHORE_PUT_NOTIFY_CALL, (ALIGN_TYPE) semaphore_ptr, (ALIGN_TYPE) semaphore_put_notify, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_create.c b/common_modules/module_lib/src/txm_thread_create.c
new file mode 100644
index 00000000..1a756ea7
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_create.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread create function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread control block pointer */
+/* name Pointer to thread name string */
+/* entry_function Entry function of the thread */
+/* entry_input 32-bit input value to thread */
+/* stack_start Pointer to start of stack */
+/* stack_size Stack size in bytes */
+/* priority Priority of thread (0-31) */
+/* preempt_threshold Preemption threshold */
+/* time_slice Thread time-slice value */
+/* auto_start Automatic start selection */
+/* thread_control_block_size Size of thread control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_PTR_ERROR Invalid entry point or stack */
+/* address */
+/* TX_SIZE_ERROR Invalid stack size -too small */
+/* TX_PRIORITY_ERROR Invalid thread priority */
+/* TX_THRESH_ERROR Invalid preemption threshold */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input), ULONG entry_input, VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start, UINT thread_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[9];
+
+ extra_parameters[0] = (ALIGN_TYPE) entry_function;
+ extra_parameters[1] = (ALIGN_TYPE) entry_input;
+ extra_parameters[2] = (ALIGN_TYPE) stack_start;
+ extra_parameters[3] = (ALIGN_TYPE) stack_size;
+ extra_parameters[4] = (ALIGN_TYPE) priority;
+ extra_parameters[5] = (ALIGN_TYPE) preempt_threshold;
+ extra_parameters[6] = (ALIGN_TYPE) time_slice;
+ extra_parameters[7] = (ALIGN_TYPE) auto_start;
+ extra_parameters[8] = (ALIGN_TYPE) thread_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_CREATE_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_delete.c b/common_modules/module_lib/src/txm_thread_delete.c
new file mode 100644
index 00000000..d8812755
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_delete.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread delete function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to suspend */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_delete(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_DELETE_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_entry_exit_notify.c b/common_modules/module_lib/src/txm_thread_entry_exit_notify.c
new file mode 100644
index 00000000..163b666f
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_entry_exit_notify.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_entry_exit_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread entry/exit notify */
+/* callback function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread */
+/* thread_entry_exit_notify Pointer to notify callback */
+/* function, TX_NULL to disable*/
+/* */
+/* OUTPUT */
+/* */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_ENTRY_EXIT_NOTIFY_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) thread_entry_exit_notify, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_identify.c b/common_modules/module_lib/src/txm_thread_identify.c
new file mode 100644
index 00000000..b2c5eb10
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_identify.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_identify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the control block pointer of the currently */
+/* executing thread. If the return value is NULL, no thread is */
+/* executing. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD * Pointer to control block of */
+/* currently executing thread */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+TX_THREAD *_tx_thread_identify(VOID)
+{
+
+TX_THREAD *return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (TX_THREAD *) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_IDENTIFY_CALL, 0, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_info_get.c b/common_modules/module_lib/src/txm_thread_info_get.c
new file mode 100644
index 00000000..a8ecc93c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_info_get.c
@@ -0,0 +1,95 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread control block */
+/* name Destination for the thread name */
+/* state Destination for thread state */
+/* run_count Destination for thread run count */
+/* priority Destination for thread priority */
+/* preemption_threshold Destination for thread preemption-*/
+/* threshold */
+/* time_slice Destination for thread time-slice */
+/* next_thread Destination for next created */
+/* thread */
+/* next_suspended_thread Destination for next suspended */
+/* thread */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[7];
+
+ extra_parameters[0] = (ALIGN_TYPE) state;
+ extra_parameters[1] = (ALIGN_TYPE) run_count;
+ extra_parameters[2] = (ALIGN_TYPE) priority;
+ extra_parameters[3] = (ALIGN_TYPE) preemption_threshold;
+ extra_parameters[4] = (ALIGN_TYPE) time_slice;
+ extra_parameters[5] = (ALIGN_TYPE) next_thread;
+ extra_parameters[6] = (ALIGN_TYPE) next_suspended_thread;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_INFO_GET_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_interrupt_control.c b/common_modules/module_lib/src/txm_thread_interrupt_control.c
new file mode 100644
index 00000000..a3df15ed
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_interrupt_control.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_interrupt_control PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is responsible for changing the interrupt lockout */
+/* posture of the system. */
+/* */
+/* INPUT */
+/* */
+/* new_posture New interrupt lockout posture */
+/* */
+/* OUTPUT */
+/* */
+/* status | old_posture Return status if feature not */
+/* enabled, old interrupt lockout */
+/* posture if feature enabled. */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_thread_interrupt_control(UINT new_posture)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_INTERRUPT_CONTROL_CALL, (ALIGN_TYPE) new_posture, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_performance_info_get.c b/common_modules/module_lib/src/txm_thread_performance_info_get.c
new file mode 100644
index 00000000..af58f66f
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_performance_info_get.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* thread. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread control block */
+/* resumptions Destination for number of times */
+/* thread was resumed */
+/* suspensions Destination for number of times */
+/* thread was suspended */
+/* solicited_preemptions Destination for number of times */
+/* thread called another service */
+/* that resulted in preemption */
+/* interrupt_preemptions Destination for number of times */
+/* thread was preempted by another */
+/* thread made ready in Interrupt */
+/* Service Routine (ISR) */
+/* priority_inversions Destination for number of times */
+/* a priority inversion was */
+/* detected for this thread */
+/* time_slices Destination for number of times */
+/* thread was time-sliced */
+/* relinquishes Destination for number of thread */
+/* relinquishes */
+/* timeouts Destination for number of timeouts*/
+/* for thread */
+/* wait_aborts Destination for number of wait */
+/* aborts for thread */
+/* last_preempted_by Destination for pointer of the */
+/* thread that last preempted this */
+/* thread */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[9];
+
+ extra_parameters[0] = (ALIGN_TYPE) suspensions;
+ extra_parameters[1] = (ALIGN_TYPE) solicited_preemptions;
+ extra_parameters[2] = (ALIGN_TYPE) interrupt_preemptions;
+ extra_parameters[3] = (ALIGN_TYPE) priority_inversions;
+ extra_parameters[4] = (ALIGN_TYPE) time_slices;
+ extra_parameters[5] = (ALIGN_TYPE) relinquishes;
+ extra_parameters[6] = (ALIGN_TYPE) timeouts;
+ extra_parameters[7] = (ALIGN_TYPE) wait_aborts;
+ extra_parameters[8] = (ALIGN_TYPE) last_preempted_by;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) resumptions, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_performance_system_info_get.c b/common_modules/module_lib/src/txm_thread_performance_system_info_get.c
new file mode 100644
index 00000000..a696f74c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_performance_system_info_get.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves thread system performance information. */
+/* */
+/* INPUT */
+/* */
+/* resumptions Destination for total number of */
+/* thread resumptions */
+/* suspensions Destination for total number of */
+/* thread suspensions */
+/* solicited_preemptions Destination for total number of */
+/* thread preemption from thread */
+/* API calls */
+/* interrupt_preemptions Destination for total number of */
+/* thread preemptions as a result */
+/* of threads made ready inside of */
+/* Interrupt Service Routines */
+/* priority_inversions Destination for total number of */
+/* priority inversions */
+/* time_slices Destination for total number of */
+/* time-slices */
+/* relinquishes Destination for total number of */
+/* relinquishes */
+/* timeouts Destination for total number of */
+/* timeouts */
+/* wait_aborts Destination for total number of */
+/* wait aborts */
+/* non_idle_returns Destination for total number of */
+/* times threads return when */
+/* another thread is ready */
+/* idle_returns Destination for total number of */
+/* times threads return when no */
+/* other thread is ready */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions, ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, ULONG *non_idle_returns, ULONG *idle_returns)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[9];
+
+ extra_parameters[0] = (ALIGN_TYPE) solicited_preemptions;
+ extra_parameters[1] = (ALIGN_TYPE) interrupt_preemptions;
+ extra_parameters[2] = (ALIGN_TYPE) priority_inversions;
+ extra_parameters[3] = (ALIGN_TYPE) time_slices;
+ extra_parameters[4] = (ALIGN_TYPE) relinquishes;
+ extra_parameters[5] = (ALIGN_TYPE) timeouts;
+ extra_parameters[6] = (ALIGN_TYPE) wait_aborts;
+ extra_parameters[7] = (ALIGN_TYPE) non_idle_returns;
+ extra_parameters[8] = (ALIGN_TYPE) idle_returns;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) resumptions, (ALIGN_TYPE) suspensions, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_preemption_change.c b/common_modules/module_lib/src/txm_thread_preemption_change.c
new file mode 100644
index 00000000..ef9195ef
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_preemption_change.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_preemption_change PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the preemption threshold change */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread */
+/* new_threshold New preemption threshold */
+/* old_threshold Old preemption threshold */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_PTR_ERROR Invalid old threshold pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, UINT *old_threshold)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_PREEMPTION_CHANGE_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) new_threshold, (ALIGN_TYPE) old_threshold);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_priority_change.c b/common_modules/module_lib/src/txm_thread_priority_change.c
new file mode 100644
index 00000000..08da0b00
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_priority_change.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_priority_change PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the change priority function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to suspend */
+/* new_priority New thread priority */
+/* old_priority Old thread priority */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_PTR_ERROR Invalid old priority pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority, UINT *old_priority)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_PRIORITY_CHANGE_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) new_priority, (ALIGN_TYPE) old_priority);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_relinquish.c b/common_modules/module_lib/src/txm_thread_relinquish.c
new file mode 100644
index 00000000..cc7acc9a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_relinquish.c
@@ -0,0 +1,70 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_relinquish PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks to make sure a thread is executing before the */
+/* relinquish is executed. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txe_thread_relinquish(VOID)
+{
+
+
+ /* Call module manager dispatcher. */
+ (_txm_module_kernel_call_dispatcher)(TXM_THREAD_RELINQUISH_CALL, 0, 0, 0);
+}
diff --git a/common_modules/module_lib/src/txm_thread_reset.c b/common_modules/module_lib/src/txm_thread_reset.c
new file mode 100644
index 00000000..b907f30d
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_reset.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_reset PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread reset function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to reset */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_reset(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_RESET_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_resume.c b/common_modules/module_lib/src/txm_thread_resume.c
new file mode 100644
index 00000000..8738f346
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_resume.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_resume PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the resume thread function call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to resume */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_resume(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_RESUME_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_sleep.c b/common_modules/module_lib/src/txm_thread_sleep.c
new file mode 100644
index 00000000..f9e9a291
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_sleep.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_sleep PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function handles application thread sleep requests. If the */
+/* sleep request was called from a non-thread, an error is returned. */
+/* */
+/* INPUT */
+/* */
+/* timer_ticks Number of timer ticks to sleep*/
+/* */
+/* OUTPUT */
+/* */
+/* status Return completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_thread_sleep(ULONG timer_ticks)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_SLEEP_CALL, (ALIGN_TYPE) timer_ticks, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_stack_error_notify.c b/common_modules/module_lib/src/txm_thread_stack_error_notify.c
new file mode 100644
index 00000000..f982ed29
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_stack_error_notify.c
@@ -0,0 +1,78 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_stack_error_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function registers an application stack error handler. If */
+/* ThreadX detects a stack error, this application handler is called. */
+/* */
+/* Note: stack checking must be enabled for this routine to serve any */
+/* purpose via the TX_ENABLE_STACK_CHECKING define. */
+/* */
+/* INPUT */
+/* */
+/* stack_error_handler Pointer to stack error */
+/* handler, TX_NULL to disable */
+/* */
+/* OUTPUT */
+/* */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_thread_stack_error_notify(VOID (*stack_error_handler)(TX_THREAD *thread_ptr))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_STACK_ERROR_NOTIFY_CALL, (ALIGN_TYPE) stack_error_handler, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_suspend.c b/common_modules/module_lib/src/txm_thread_suspend.c
new file mode 100644
index 00000000..a1a496da
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_suspend.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_suspend PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread suspend function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to suspend */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_suspend(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_SUSPEND_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_terminate.c b/common_modules/module_lib/src/txm_thread_terminate.c
new file mode 100644
index 00000000..a082e45b
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_terminate.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_terminate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread terminate function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to suspend */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_terminate(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_TERMINATE_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_time_slice_change.c b/common_modules/module_lib/src/txm_thread_time_slice_change.c
new file mode 100644
index 00000000..8fbb892e
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_time_slice_change.c
@@ -0,0 +1,78 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_time_slice_change PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the time slice change function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread */
+/* new_time_slice New time slice */
+/* old_time_slice Old time slice */
+/* */
+/* OUTPUT */
+/* */
+/* TX_THREAD_ERROR Invalid thread pointer */
+/* TX_CALLER_ERROR Invalid caller of function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_TIME_SLICE_CHANGE_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) new_time_slice, (ALIGN_TYPE) old_time_slice);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_thread_wait_abort.c b/common_modules/module_lib/src/txm_thread_wait_abort.c
new file mode 100644
index 00000000..ba2da979
--- /dev/null
+++ b/common_modules/module_lib/src/txm_thread_wait_abort.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_thread_wait_abort PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the thread wait abort function */
+/* call. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread to abort the wait on */
+/* */
+/* OUTPUT */
+/* */
+/* status Return completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_WAIT_ABORT_CALL, (ALIGN_TYPE) thread_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_time_get.c b/common_modules/module_lib/src/txm_time_get.c
new file mode 100644
index 00000000..679acaca
--- /dev/null
+++ b/common_modules/module_lib/src/txm_time_get.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_time_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves the internal, free-running, system clock */
+/* and returns it to the caller. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* _tx_timer_system_clock Returns the system clock value */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+ULONG _tx_time_get(VOID)
+{
+
+ULONG return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (ULONG) (_txm_module_kernel_call_dispatcher)(TXM_TIME_GET_CALL, 0, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_time_set.c b/common_modules/module_lib/src/txm_time_set.c
new file mode 100644
index 00000000..6e081b5a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_time_set.c
@@ -0,0 +1,70 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_time_set PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function modifies the internal, free-running, system clock */
+/* as specified by the caller. */
+/* */
+/* INPUT */
+/* */
+/* new_time New time value */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _tx_time_set(ULONG new_time)
+{
+
+
+ /* Call module manager dispatcher. */
+ (_txm_module_kernel_call_dispatcher)(TXM_TIME_SET_CALL, (ALIGN_TYPE) new_time, 0, 0);
+}
diff --git a/common_modules/module_lib/src/txm_timer_activate.c b/common_modules/module_lib/src/txm_timer_activate.c
new file mode 100644
index 00000000..cf13e61d
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_activate.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_activate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the activate application timer */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid application timer */
+/* TX_ACTIVATE_ERROR Application timer already active */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_activate(TX_TIMER *timer_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_ACTIVATE_CALL, (ALIGN_TYPE) timer_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_change.c b/common_modules/module_lib/src/txm_timer_change.c
new file mode 100644
index 00000000..31da4ac9
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_change.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_change PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the application timer change */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* initial_ticks Initial expiration ticks */
+/* reschedule_ticks Reschedule ticks */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid application timer pointer */
+/* TX_TICK_ERROR Invalid initial tick value of 0 */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_CHANGE_CALL, (ALIGN_TYPE) timer_ptr, (ALIGN_TYPE) initial_ticks, (ALIGN_TYPE) reschedule_ticks);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_create.c b/common_modules/module_lib/src/txm_timer_create.c
new file mode 100644
index 00000000..b70abd0a
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_create.c
@@ -0,0 +1,92 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the create application timer */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* name_ptr Pointer to timer name */
+/* expiration_function Application expiration function */
+/* initial_ticks Initial expiration ticks */
+/* reschedule_ticks Reschedule ticks */
+/* auto_activate Automatic activation flag */
+/* timer_control_block_size Size of timer control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid timer control block */
+/* TX_TICK_ERROR Invalid initial expiration count */
+/* TX_ACTIVATE_ERROR Invalid timer activation option */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[6];
+
+ extra_parameters[0] = (ALIGN_TYPE) expiration_function;
+ extra_parameters[1] = (ALIGN_TYPE) expiration_input;
+ extra_parameters[2] = (ALIGN_TYPE) initial_ticks;
+ extra_parameters[3] = (ALIGN_TYPE) reschedule_ticks;
+ extra_parameters[4] = (ALIGN_TYPE) auto_activate;
+ extra_parameters[5] = (ALIGN_TYPE) timer_control_block_size;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_CREATE_CALL, (ALIGN_TYPE) timer_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_deactivate.c b/common_modules/module_lib/src/txm_timer_deactivate.c
new file mode 100644
index 00000000..7f74bc5c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_deactivate.c
@@ -0,0 +1,75 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_deactivate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the deactivate application timer */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid application timer pointer */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_deactivate(TX_TIMER *timer_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_DEACTIVATE_CALL, (ALIGN_TYPE) timer_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_delete.c b/common_modules/module_lib/src/txm_timer_delete.c
new file mode 100644
index 00000000..df7421bc
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_delete.c
@@ -0,0 +1,76 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_delete PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the delete application timer */
+/* function call. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid application timer pointer */
+/* TX_CALLER_ERROR Invalid caller of this function */
+/* status Actual completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_delete(TX_TIMER *timer_ptr)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_DELETE_CALL, (ALIGN_TYPE) timer_ptr, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_info_get.c b/common_modules/module_lib/src/txm_timer_info_get.c
new file mode 100644
index 00000000..890df7f5
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_info_get.c
@@ -0,0 +1,88 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txe_timer_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks for errors in the timer information get */
+/* service. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* name Destination for the timer name */
+/* active Destination for active flag */
+/* remaining_ticks Destination for remaining ticks */
+/* before expiration */
+/* reschedule_ticks Destination for reschedule ticks */
+/* next_timer Destination for next timer on the */
+/* created list */
+/* */
+/* OUTPUT */
+/* */
+/* TX_TIMER_ERROR Invalid timer pointer */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) active;
+ extra_parameters[1] = (ALIGN_TYPE) remaining_ticks;
+ extra_parameters[2] = (ALIGN_TYPE) reschedule_ticks;
+ extra_parameters[3] = (ALIGN_TYPE) next_timer;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_INFO_GET_CALL, (ALIGN_TYPE) timer_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_performance_info_get.c b/common_modules/module_lib/src/txm_timer_performance_info_get.c
new file mode 100644
index 00000000..1896f344
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_performance_info_get.c
@@ -0,0 +1,91 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_timer_performance_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves performance information from the specified */
+/* timer. */
+/* */
+/* INPUT */
+/* */
+/* timer_ptr Pointer to timer control block */
+/* activates Destination for the number of */
+/* activations of this timer */
+/* reactivates Destination for the number of */
+/* reactivations of this timer */
+/* deactivates Destination for the number of */
+/* deactivations of this timer */
+/* expirations Destination for the number of */
+/* expirations of this timer */
+/* expiration_adjusts Destination for the number of */
+/* expiration adjustments of this */
+/* timer */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates, ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[4];
+
+ extra_parameters[0] = (ALIGN_TYPE) reactivates;
+ extra_parameters[1] = (ALIGN_TYPE) deactivates;
+ extra_parameters[2] = (ALIGN_TYPE) expirations;
+ extra_parameters[3] = (ALIGN_TYPE) expiration_adjusts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) timer_ptr, (ALIGN_TYPE) activates, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_timer_performance_system_info_get.c b/common_modules/module_lib/src/txm_timer_performance_system_info_get.c
new file mode 100644
index 00000000..43a00acf
--- /dev/null
+++ b/common_modules/module_lib/src/txm_timer_performance_system_info_get.c
@@ -0,0 +1,87 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_timer_performance_system_info_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves timer performance information. */
+/* */
+/* INPUT */
+/* */
+/* activates Destination for total number of */
+/* activations */
+/* reactivates Destination for total number of */
+/* reactivations */
+/* deactivates Destination for total number of */
+/* deactivations */
+/* expirations Destination for total number of */
+/* expirations */
+/* expiration_adjusts Destination for total number of */
+/* expiration adjustments */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_timer_performance_system_info_get(ULONG *activates, ULONG *reactivates, ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) deactivates;
+ extra_parameters[1] = (ALIGN_TYPE) expirations;
+ extra_parameters[2] = (ALIGN_TYPE) expiration_adjusts;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TIMER_PERFORMANCE_SYSTEM_INFO_GET_CALL, (ALIGN_TYPE) activates, (ALIGN_TYPE) reactivates, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_buffer_full_notify.c b/common_modules/module_lib/src/txm_trace_buffer_full_notify.c
new file mode 100644
index 00000000..703cade7
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_buffer_full_notify.c
@@ -0,0 +1,77 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_buffer_full_notify PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sets up the application callback function that is */
+/* called whenever the trace buffer becomes full. The application */
+/* can then swap to a new trace buffer in order not to lose any */
+/* events. */
+/* */
+/* INPUT */
+/* */
+/* full_buffer_callback Full trace buffer processing */
+/* function */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer))
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_BUFFER_FULL_NOTIFY_CALL, (ALIGN_TYPE) full_buffer_callback, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_disable.c b/common_modules/module_lib/src/txm_trace_disable.c
new file mode 100644
index 00000000..9e5ab99b
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_disable.c
@@ -0,0 +1,73 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_disable PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function disables trace inside of ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_disable(VOID)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_DISABLE_CALL, 0, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_enable.c b/common_modules/module_lib/src/txm_trace_enable.c
new file mode 100644
index 00000000..2e14265c
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_enable.c
@@ -0,0 +1,77 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_enable PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function initializes the ThreadX trace buffer and the */
+/* associated control variables, enabling it for operation. */
+/* */
+/* INPUT */
+/* */
+/* trace_buffer_start Start of trace buffer */
+/* trace_buffer_size Size (bytes) of trace buffer */
+/* registry_entries Number of object registry */
+/* entries. */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_enable(VOID *trace_buffer_start, ULONG trace_buffer_size, ULONG registry_entries)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_ENABLE_CALL, (ALIGN_TYPE) trace_buffer_start, (ALIGN_TYPE) trace_buffer_size, (ALIGN_TYPE) registry_entries);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_event_filter.c b/common_modules/module_lib/src/txm_trace_event_filter.c
new file mode 100644
index 00000000..dda12e36
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_event_filter.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_event_filter PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sets up the event filter, which allows the */
+/* application to filter various trace events during run-time. */
+/* */
+/* INPUT */
+/* */
+/* event_filter_bits Trace filter event bit(s) */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_event_filter(ULONG event_filter_bits)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_EVENT_FILTER_CALL, (ALIGN_TYPE) event_filter_bits, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_event_unfilter.c b/common_modules/module_lib/src/txm_trace_event_unfilter.c
new file mode 100644
index 00000000..fcff4a38
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_event_unfilter.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_event_unfilter PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function removes the event filter, which allows the */
+/* application to un-filter various trace events during run-time. */
+/* */
+/* INPUT */
+/* */
+/* event_unfilter_bits Trace un-filter event bit(s) */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_event_unfilter(ULONG event_unfilter_bits)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_EVENT_UNFILTER_CALL, (ALIGN_TYPE) event_unfilter_bits, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_interrupt_control.c b/common_modules/module_lib/src/txm_trace_interrupt_control.c
new file mode 100644
index 00000000..76cb7ebb
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_interrupt_control.c
@@ -0,0 +1,74 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_interrupt_control PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function provides a shell for the tx_interrupt_control */
+/* function so that a trace event can be logged for its use. */
+/* */
+/* INPUT */
+/* */
+/* new_posture New interrupt posture */
+/* */
+/* OUTPUT */
+/* */
+/* Previous Interrupt Posture */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_interrupt_control(UINT new_posture)
+{
+
+UINT return_value;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_INTERRUPT_CONTROL_CALL, (ALIGN_TYPE) new_posture, 0, 0);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_lib/src/txm_trace_isr_enter_insert.c b/common_modules/module_lib/src/txm_trace_isr_enter_insert.c
new file mode 100644
index 00000000..734aaa61
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_isr_enter_insert.c
@@ -0,0 +1,70 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_isr_enter_insert PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function provides inserts an ISR entry event into the trace */
+/* buffer. */
+/* */
+/* INPUT */
+/* */
+/* isr_id User defined ISR ID */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _tx_trace_isr_enter_insert(ULONG isr_id)
+{
+
+
+ /* Call module manager dispatcher. */
+ (_txm_module_kernel_call_dispatcher)(TXM_TRACE_ISR_ENTER_INSERT_CALL, (ALIGN_TYPE) isr_id, 0, 0);
+}
diff --git a/common_modules/module_lib/src/txm_trace_isr_exit_insert.c b/common_modules/module_lib/src/txm_trace_isr_exit_insert.c
new file mode 100644
index 00000000..9d79c1e4
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_isr_exit_insert.c
@@ -0,0 +1,70 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_isr_exit_insert PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function provides inserts an ISR exit event into the trace */
+/* buffer. */
+/* */
+/* INPUT */
+/* */
+/* isr_id User defined ISR ID */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _tx_trace_isr_exit_insert(ULONG isr_id)
+{
+
+
+ /* Call module manager dispatcher. */
+ (_txm_module_kernel_call_dispatcher)(TXM_TRACE_ISR_EXIT_INSERT_CALL, (ALIGN_TYPE) isr_id, 0, 0);
+}
diff --git a/common_modules/module_lib/src/txm_trace_user_event_insert.c b/common_modules/module_lib/src/txm_trace_user_event_insert.c
new file mode 100644
index 00000000..156d0b94
--- /dev/null
+++ b/common_modules/module_lib/src/txm_trace_user_event_insert.c
@@ -0,0 +1,82 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TXM_MODULE
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_trace_user_event_insert PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function inserts a user-defined event into the trace buffer. */
+/* */
+/* INPUT */
+/* */
+/* event_id User Event ID */
+/* info_field_1 First information field */
+/* info_field_2 First information field */
+/* info_field_3 First information field */
+/* info_field_4 First information field */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_kernel_call_dispatcher */
+/* */
+/* CALLED BY */
+/* */
+/* Module application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _tx_trace_user_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4)
+{
+
+UINT return_value;
+ALIGN_TYPE extra_parameters[3];
+
+ extra_parameters[0] = (ALIGN_TYPE) info_field_2;
+ extra_parameters[1] = (ALIGN_TYPE) info_field_3;
+ extra_parameters[2] = (ALIGN_TYPE) info_field_4;
+
+ /* Call module manager dispatcher. */
+ return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_TRACE_USER_EVENT_INSERT_CALL, (ALIGN_TYPE) event_id, (ALIGN_TYPE) info_field_1, (ALIGN_TYPE) extra_parameters);
+
+ /* Return value to the caller. */
+ return(return_value);
+}
diff --git a/common_modules/module_manager/inc/txm_module_manager_dispatch.h b/common_modules/module_manager/inc/txm_module_manager_dispatch.h
new file mode 100644
index 00000000..42aa1bab
--- /dev/null
+++ b/common_modules/module_manager/inc/txm_module_manager_dispatch.h
@@ -0,0 +1,3029 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+/* UINT _txe_block_allocate(
+ TX_BLOCK_POOL *pool_ptr, -> param_0
+ VOID **block_ptr, -> param_1
+ ULONG wait_option -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_allocate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(VOID *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_allocate(
+ (TX_BLOCK_POOL *) param_0,
+ (VOID **) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_block_pool_create(
+ TX_BLOCK_POOL *pool_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ ULONG block_size, -> extra_parameters[0]
+ VOID *pool_start, -> extra_parameters[1]
+ ULONG pool_size, -> extra_parameters[2]
+ UINT pool_control_block_size -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], extra_parameters[2]))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_pool_create(
+ (TX_BLOCK_POOL *) param_0,
+ (CHAR *) param_1,
+ (ULONG) extra_parameters[0],
+ (VOID *) extra_parameters[1],
+ (ULONG) extra_parameters[2],
+ (UINT) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_block_pool_delete(
+ TX_BLOCK_POOL *pool_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_pool_delete(
+ (TX_BLOCK_POOL *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_block_pool_info_get(
+ TX_BLOCK_POOL *pool_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *available_blocks, -> extra_parameters[0]
+ ULONG *total_blocks, -> extra_parameters[1]
+ TX_THREAD **first_suspended, -> extra_parameters[2]
+ ULONG *suspended_count, -> extra_parameters[3]
+ TX_BLOCK_POOL **next_pool -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(TX_BLOCK_POOL *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_pool_info_get(
+ (TX_BLOCK_POOL *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (TX_THREAD **) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (TX_BLOCK_POOL **) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_block_pool_performance_info_get(
+ TX_BLOCK_POOL *pool_ptr, -> param_0
+ ULONG *allocates, -> param_1
+ ULONG *releases, -> extra_parameters[0]
+ ULONG *suspensions, -> extra_parameters[1]
+ ULONG *timeouts -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_block_pool_performance_info_get(
+ (TX_BLOCK_POOL *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_block_pool_performance_system_info_get(
+ ULONG *allocates, -> param_0
+ ULONG *releases, -> param_1
+ ULONG *suspensions, -> extra_parameters[0]
+ ULONG *timeouts -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_block_pool_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_block_pool_prioritize(
+ TX_BLOCK_POOL *pool_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_pool_prioritize_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BLOCK_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_pool_prioritize(
+ (TX_BLOCK_POOL *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_block_release(
+ VOID *block_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_block_release_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+ALIGN_TYPE block_header_start;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ /* Is the pointer non-null? */
+ if ((void *) param_0 != TX_NULL)
+ {
+
+ /* Calculate the beginning of the header info for this block (the header
+ consists of 1 pointers. */
+ block_header_start = param_0 - sizeof(ALIGN_TYPE);
+
+ if (/* Did we underflow when doing the subtract? */
+ (block_header_start > param_0) ||
+ /* Ensure the pointer is inside the module's data. Note that we only
+ check the pointer in the header because only that pointer is
+ dereferenced during the pointer's validity check in _tx_block_release. */
+ (!TXM_MODULE_MANAGER_CHECK_INSIDE_DATA(module_instance, block_header_start, sizeof(ALIGN_TYPE))))
+ {
+
+ /* Invalid pointer. */
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+ }
+ }
+
+ return_value = (ALIGN_TYPE) _txe_block_release(
+ (VOID *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_byte_allocate(
+ TX_BYTE_POOL *pool_ptr, -> param_0
+ VOID **memory_ptr, -> param_1
+ ULONG memory_size, -> extra_parameters[0]
+ ULONG wait_option -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_allocate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(VOID *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_allocate(
+ (TX_BYTE_POOL *) param_0,
+ (VOID **) param_1,
+ (ULONG) extra_parameters[0],
+ (ULONG) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_byte_pool_create(
+ TX_BYTE_POOL *pool_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ VOID *pool_start, -> extra_parameters[0]
+ ULONG pool_size, -> extra_parameters[1]
+ UINT pool_control_block_size -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], extra_parameters[1]))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_pool_create(
+ (TX_BYTE_POOL *) param_0,
+ (CHAR *) param_1,
+ (VOID *) extra_parameters[0],
+ (ULONG) extra_parameters[1],
+ (UINT) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_byte_pool_delete(
+ TX_BYTE_POOL *pool_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_pool_delete(
+ (TX_BYTE_POOL *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_byte_pool_info_get(
+ TX_BYTE_POOL *pool_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *available_bytes, -> extra_parameters[0]
+ ULONG *fragments, -> extra_parameters[1]
+ TX_THREAD **first_suspended, -> extra_parameters[2]
+ ULONG *suspended_count, -> extra_parameters[3]
+ TX_BYTE_POOL **next_pool -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(TX_BYTE_POOL *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_pool_info_get(
+ (TX_BYTE_POOL *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (TX_THREAD **) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (TX_BYTE_POOL **) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_byte_pool_performance_info_get(
+ TX_BYTE_POOL *pool_ptr, -> param_0
+ ULONG *allocates, -> param_1
+ ULONG *releases, -> extra_parameters[0]
+ ULONG *fragments_searched, -> extra_parameters[1]
+ ULONG *merges, -> extra_parameters[2]
+ ULONG *splits, -> extra_parameters[3]
+ ULONG *suspensions, -> extra_parameters[4]
+ ULONG *timeouts -> extra_parameters[5]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[5], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_byte_pool_performance_info_get(
+ (TX_BYTE_POOL *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4],
+ (ULONG *) extra_parameters[5]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_byte_pool_performance_system_info_get(
+ ULONG *allocates, -> param_0
+ ULONG *releases, -> param_1
+ ULONG *fragments_searched, -> extra_parameters[0]
+ ULONG *merges, -> extra_parameters[1]
+ ULONG *splits, -> extra_parameters[2]
+ ULONG *suspensions, -> extra_parameters[3]
+ ULONG *timeouts -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_byte_pool_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_byte_pool_prioritize(
+ TX_BYTE_POOL *pool_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_pool_prioritize_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_BYTE_POOL)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_pool_prioritize(
+ (TX_BYTE_POOL *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_byte_release(
+ VOID *memory_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_byte_release_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+ALIGN_TYPE block_header_start;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ /* Is the pointer non-null? */
+ if ((void *) param_0 != TX_NULL)
+ {
+
+ /* Calculate the beginning of the header info for this block (the header
+ consists of 2 pointers). */
+ block_header_start = param_0 - 2*sizeof(ALIGN_TYPE);
+
+ if (/* Did we underflow when doing the subtract? */
+ (block_header_start > param_0) ||
+ /* Ensure the pointer is inside the module's data. Note that we only
+ check the pointers in the header because only those two are
+ dereferenced during the pointer's validity check in _tx_byte_release. */
+ (!TXM_MODULE_MANAGER_CHECK_INSIDE_DATA(module_instance, block_header_start, 2*sizeof(ALIGN_TYPE))))
+ {
+
+ /* Invalid pointer. */
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+ }
+ }
+
+ return_value = (ALIGN_TYPE) _txe_byte_release(
+ (VOID *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_create(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ UINT event_control_block_size -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_create(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (CHAR *) param_1,
+ (UINT) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_delete(
+ TX_EVENT_FLAGS_GROUP *group_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_delete(
+ (TX_EVENT_FLAGS_GROUP *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_get(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ ULONG requested_flags, -> param_1
+ UINT get_option, -> extra_parameters[0]
+ ULONG *actual_flags_ptr, -> extra_parameters[1]
+ ULONG wait_option -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_get(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (ULONG) param_1,
+ (UINT) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_info_get(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *current_flags, -> extra_parameters[0]
+ TX_THREAD **first_suspended, -> extra_parameters[1]
+ ULONG *suspended_count, -> extra_parameters[2]
+ TX_EVENT_FLAGS_GROUP **next_group -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(TX_EVENT_FLAGS_GROUP *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_info_get(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (TX_THREAD **) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (TX_EVENT_FLAGS_GROUP **) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_event_flags_performance_info_get(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ ULONG *sets, -> param_1
+ ULONG *gets, -> extra_parameters[0]
+ ULONG *suspensions, -> extra_parameters[1]
+ ULONG *timeouts -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_event_flags_performance_info_get(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_event_flags_performance_system_info_get(
+ ULONG *sets, -> param_0
+ ULONG *gets, -> param_1
+ ULONG *suspensions, -> extra_parameters[0]
+ ULONG *timeouts -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_event_flags_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_set(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ ULONG flags_to_set, -> param_1
+ UINT set_option -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_set_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_set(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (ULONG) param_1,
+ (UINT) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_event_flags_set_notify(
+ TX_EVENT_FLAGS_GROUP *group_ptr, -> param_0
+ VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *) -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_event_flags_set_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+TX_EVENT_FLAGS_GROUP *event_flags_ptr = (TX_EVENT_FLAGS_GROUP *)param_0;
+VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *);
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_EVENT_FLAGS_GROUP)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* Since we need to write to the object, ensure it's valid. */
+ if ((event_flags_ptr == TX_NULL) || (event_flags_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID))
+ return(TX_GROUP_ERROR);
+ }
+
+ /* Is it a disable request? */
+ if ((void *) param_1 == TX_NULL)
+ {
+
+ /* Clear the callback. */
+ events_set_notify = (VOID (*)(TX_EVENT_FLAGS_GROUP *)) TX_NULL;
+ }
+ else
+ {
+
+ /* Setup trampoline values. */
+ event_flags_ptr -> tx_event_flags_group_module_instance = (VOID *) module_instance;
+ event_flags_ptr -> tx_event_flags_group_set_module_notify = (VOID (*)(TX_EVENT_FLAGS_GROUP *)) param_1;
+ events_set_notify = _txm_module_manager_event_flags_notify_trampoline;
+ }
+
+ return_value = (ALIGN_TYPE) _txe_event_flags_set_notify(
+ (TX_EVENT_FLAGS_GROUP *) param_0,
+ (VOID (*)(TX_EVENT_FLAGS_GROUP *)) events_set_notify
+ );
+ return(return_value);
+}
+
+/* UINT _txe_mutex_create(
+ TX_MUTEX *mutex_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ UINT inherit, -> extra_parameters[0]
+ UINT mutex_control_block_size -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_create(
+ (TX_MUTEX *) param_0,
+ (CHAR *) param_1,
+ (UINT) extra_parameters[0],
+ (UINT) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_mutex_delete(
+ TX_MUTEX *mutex_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_delete(
+ (TX_MUTEX *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_mutex_get(
+ TX_MUTEX *mutex_ptr, -> param_0
+ ULONG wait_option -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_get(
+ (TX_MUTEX *) param_0,
+ (ULONG) param_1
+ );
+ return(return_value);
+}
+
+/* UINT _txe_mutex_info_get(
+ TX_MUTEX *mutex_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *count, -> extra_parameters[0]
+ TX_THREAD **owner, -> extra_parameters[1]
+ TX_THREAD **first_suspended, -> extra_parameters[2]
+ ULONG *suspended_count, -> extra_parameters[3]
+ TX_MUTEX **next_mutex -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(TX_MUTEX *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_info_get(
+ (TX_MUTEX *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (TX_THREAD **) extra_parameters[1],
+ (TX_THREAD **) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (TX_MUTEX **) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_mutex_performance_info_get(
+ TX_MUTEX *mutex_ptr, -> param_0
+ ULONG *puts, -> param_1
+ ULONG *gets, -> extra_parameters[0]
+ ULONG *suspensions, -> extra_parameters[1]
+ ULONG *timeouts, -> extra_parameters[2]
+ ULONG *inversions, -> extra_parameters[3]
+ ULONG *inheritances -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_mutex_performance_info_get(
+ (TX_MUTEX *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_mutex_performance_system_info_get(
+ ULONG *puts, -> param_0
+ ULONG *gets, -> param_1
+ ULONG *suspensions, -> extra_parameters[0]
+ ULONG *timeouts, -> extra_parameters[1]
+ ULONG *inversions, -> extra_parameters[2]
+ ULONG *inheritances -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_mutex_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_mutex_prioritize(
+ TX_MUTEX *mutex_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_prioritize_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_prioritize(
+ (TX_MUTEX *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_mutex_put(
+ TX_MUTEX *mutex_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_mutex_put_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_MUTEX)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_mutex_put(
+ (TX_MUTEX *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_create(
+ TX_QUEUE *queue_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ UINT message_size, -> extra_parameters[0]
+ VOID *queue_start, -> extra_parameters[1]
+ ULONG queue_size, -> extra_parameters[2]
+ UINT queue_control_block_size -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], extra_parameters[2]))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_create(
+ (TX_QUEUE *) param_0,
+ (CHAR *) param_1,
+ (UINT) extra_parameters[0],
+ (VOID *) extra_parameters[1],
+ (ULONG) extra_parameters[2],
+ (UINT) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_delete(
+ TX_QUEUE *queue_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_delete(
+ (TX_QUEUE *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_queue_flush(
+ TX_QUEUE *queue_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_flush_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_flush(
+ (TX_QUEUE *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_front_send(
+ TX_QUEUE *queue_ptr, -> param_0
+ VOID *source_ptr, -> param_1
+ ULONG wait_option -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_front_send_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+TX_QUEUE *queue_ptr;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* We need to get the size of the message from the queue. */
+ queue_ptr = (TX_QUEUE *) param_0;
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_READ(module_instance, param_1, queue_ptr -> tx_queue_message_size))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_front_send(
+ (TX_QUEUE *) param_0,
+ (VOID *) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_info_get(
+ TX_QUEUE *queue_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *enqueued, -> extra_parameters[0]
+ ULONG *available_storage, -> extra_parameters[1]
+ TX_THREAD **first_suspended, -> extra_parameters[2]
+ ULONG *suspended_count, -> extra_parameters[3]
+ TX_QUEUE **next_queue -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(TX_QUEUE *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_info_get(
+ (TX_QUEUE *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (TX_THREAD **) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (TX_QUEUE **) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_queue_performance_info_get(
+ TX_QUEUE *queue_ptr, -> param_0
+ ULONG *messages_sent, -> param_1
+ ULONG *messages_received, -> extra_parameters[0]
+ ULONG *empty_suspensions, -> extra_parameters[1]
+ ULONG *full_suspensions, -> extra_parameters[2]
+ ULONG *full_errors, -> extra_parameters[3]
+ ULONG *timeouts -> extra_parameters[4]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_queue_performance_info_get(
+ (TX_QUEUE *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_queue_performance_system_info_get(
+ ULONG *messages_sent, -> param_0
+ ULONG *messages_received, -> param_1
+ ULONG *empty_suspensions, -> extra_parameters[0]
+ ULONG *full_suspensions, -> extra_parameters[1]
+ ULONG *full_errors, -> extra_parameters[2]
+ ULONG *timeouts -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_queue_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_prioritize(
+ TX_QUEUE *queue_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_prioritize_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_prioritize(
+ (TX_QUEUE *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_receive(
+ TX_QUEUE *queue_ptr, -> param_0
+ VOID *destination_ptr, -> param_1
+ ULONG wait_option -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_receive_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+TX_QUEUE *queue_ptr;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* We need to get the max size of the buffer from the queue. */
+ queue_ptr = (TX_QUEUE *) param_0;
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)*queue_ptr -> tx_queue_message_size))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_receive(
+ (TX_QUEUE *) param_0,
+ (VOID *) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_send(
+ TX_QUEUE *queue_ptr, -> param_0
+ VOID *source_ptr, -> param_1
+ ULONG wait_option -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_send_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+TX_QUEUE *queue_ptr;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* We need to get the size of the message from the queue. */
+ queue_ptr = (TX_QUEUE *) param_0;
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_READ(module_instance, param_1, sizeof(ULONG)*queue_ptr -> tx_queue_message_size))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_send(
+ (TX_QUEUE *) param_0,
+ (VOID *) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_queue_send_notify(
+ TX_QUEUE *queue_ptr, -> param_0
+ VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr) -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_queue_send_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+TX_QUEUE *queue_ptr = (TX_QUEUE *) param_0;
+VOID (*queue_send_notify)(TX_QUEUE *);
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_QUEUE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* Since we need to write to the object, ensure it's valid. */
+ if ((queue_ptr == TX_NULL) || (queue_ptr -> tx_queue_id != TX_QUEUE_ID))
+ return(TX_QUEUE_ERROR);
+ }
+
+ /* Is it a disable request? */
+ if ((void *) param_1 == TX_NULL)
+ {
+
+ /* Clear the callback. */
+ queue_send_notify = (VOID (*)(TX_QUEUE *)) TX_NULL;
+ }
+ else
+ {
+
+ /* Setup trampoline values. */
+ queue_ptr -> tx_queue_module_instance = (VOID *) module_instance;
+ queue_ptr -> tx_queue_send_module_notify = (VOID (*)(TX_QUEUE *)) param_1;
+ queue_send_notify = _txm_module_manager_queue_notify_trampoline;
+ }
+
+ return_value = (ALIGN_TYPE) _txe_queue_send_notify(
+ (TX_QUEUE *) param_0,
+ (VOID (*)(TX_QUEUE *notify_queue_ptr)) queue_send_notify
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_ceiling_put(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ ULONG ceiling -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_ceiling_put_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_ceiling_put(
+ (TX_SEMAPHORE *) param_0,
+ (ULONG) param_1
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_create(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ ULONG initial_count, -> extra_parameters[0]
+ UINT semaphore_control_block_size -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_create(
+ (TX_SEMAPHORE *) param_0,
+ (CHAR *) param_1,
+ (ULONG) extra_parameters[0],
+ (UINT) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_delete(
+ TX_SEMAPHORE *semaphore_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_delete(
+ (TX_SEMAPHORE *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_get(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ ULONG wait_option -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_get(
+ (TX_SEMAPHORE *) param_0,
+ (ULONG) param_1
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_info_get(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ CHAR **name, -> param_1
+ ULONG *current_value, -> extra_parameters[0]
+ TX_THREAD **first_suspended, -> extra_parameters[1]
+ ULONG *suspended_count, -> extra_parameters[2]
+ TX_SEMAPHORE **next_semaphore -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(TX_SEMAPHORE *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_info_get(
+ (TX_SEMAPHORE *) param_0,
+ (CHAR **) param_1,
+ (ULONG *) extra_parameters[0],
+ (TX_THREAD **) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (TX_SEMAPHORE **) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_semaphore_performance_info_get(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ ULONG *puts, -> param_1
+ ULONG *gets, -> extra_parameters[0]
+ ULONG *suspensions, -> extra_parameters[1]
+ ULONG *timeouts -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_semaphore_performance_info_get(
+ (TX_SEMAPHORE *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_semaphore_performance_system_info_get(
+ ULONG *puts, -> param_0
+ ULONG *gets, -> param_1
+ ULONG *suspensions, -> extra_parameters[0]
+ ULONG *timeouts -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_semaphore_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_prioritize(
+ TX_SEMAPHORE *semaphore_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_prioritize_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_prioritize(
+ (TX_SEMAPHORE *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_put(
+ TX_SEMAPHORE *semaphore_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_put_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_put(
+ (TX_SEMAPHORE *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_semaphore_put_notify(
+ TX_SEMAPHORE *semaphore_ptr, -> param_0
+ VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr) -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_semaphore_put_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+TX_SEMAPHORE *semaphore_ptr = (TX_SEMAPHORE *) param_0;
+VOID (*semaphore_put_notify)(TX_SEMAPHORE *);
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_SEMAPHORE)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* Since we need to write to the object, ensure it's valid. */
+ if ((semaphore_ptr == TX_NULL) || (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID))
+ return(TX_SEMAPHORE_ERROR);
+ }
+
+ /* Is it a disable request? */
+ if ((void *) param_1 == TX_NULL)
+ {
+
+ /* Clear the callback. */
+ semaphore_put_notify = (VOID (*)(TX_SEMAPHORE *)) TX_NULL;
+ }
+ else
+ {
+
+ /* Setup trampoline values. */
+ semaphore_ptr -> tx_semaphore_module_instance = (VOID *) module_instance;
+ semaphore_ptr -> tx_semaphore_put_module_notify = (VOID (*)(TX_SEMAPHORE *)) param_1;
+ semaphore_put_notify = _txm_module_manager_semaphore_notify_trampoline;
+ }
+
+ return_value = (ALIGN_TYPE) _txe_semaphore_put_notify(
+ (TX_SEMAPHORE *) param_0,
+ (VOID (*)(TX_SEMAPHORE *notify_semaphore_ptr)) semaphore_put_notify
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_create(
+ TX_THREAD *thread_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ VOID (*entry_function)(ULONG entry_input), -> extra_parameters[0]
+ ULONG entry_input, -> extra_parameters[1]
+ VOID *stack_start, -> extra_parameters[2]
+ ULONG stack_size, -> extra_parameters[3]
+ UINT priority, -> extra_parameters[4]
+ UINT preempt_threshold, -> extra_parameters[5]
+ ULONG time_slice, -> extra_parameters[6]
+ UINT auto_start, -> extra_parameters[7]
+ UINT thread_control_block_size -> extra_parameters[8]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], extra_parameters[3]))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (extra_parameters[4] < module_instance -> txm_module_instance_maximum_priority)
+ return(TX_PRIORITY_ERROR);
+
+ if (extra_parameters[5] < module_instance -> txm_module_instance_maximum_priority)
+ return(TX_THRESH_ERROR);
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_thread_create(
+ (TX_THREAD *) param_0,
+ (CHAR *) param_1,
+ module_instance -> txm_module_instance_shell_entry_function,
+ (VOID (*)(ULONG entry_input)) extra_parameters[0],
+ (ULONG) extra_parameters[1],
+ (VOID *) extra_parameters[2],
+ (ULONG) extra_parameters[3],
+ (UINT) extra_parameters[4],
+ (UINT) extra_parameters[5],
+ (ULONG) extra_parameters[6],
+ (UINT) extra_parameters[7],
+ (UINT) extra_parameters[8],
+ module_instance
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_delete(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_delete(
+ (TX_THREAD *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_thread_entry_exit_notify(
+ TX_THREAD *thread_ptr, -> param_0
+ VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type) -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_entry_exit_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+TX_THREAD *thread_ptr = (TX_THREAD *) param_0;
+TXM_MODULE_THREAD_ENTRY_INFO *thread_entry_info_ptr;
+VOID (*thread_entry_exit_notify)(TX_THREAD *, UINT);
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ /* Since we need to write to the object, ensure it's valid. */
+ if ((thread_ptr == TX_NULL) || (thread_ptr -> tx_thread_id != TX_THREAD_ID))
+ return(TX_THREAD_ERROR);
+
+ /* Ensure this thread is from the module trying to set the callback. */
+ if (thread_ptr -> tx_thread_module_instance_ptr != module_instance)
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Is it a disable request? */
+ if ((void *) param_1 == TX_NULL)
+ {
+
+ /* Clear the callback. */
+ thread_entry_exit_notify = (VOID (*)(TX_THREAD *, UINT)) TX_NULL;
+ }
+ else
+ {
+
+ /* Setup trampoline values. */
+ thread_entry_info_ptr = (TXM_MODULE_THREAD_ENTRY_INFO *) thread_ptr -> tx_thread_module_entry_info_ptr;
+ thread_entry_info_ptr -> txm_module_thread_entry_info_exit_notify = (VOID (*)(TX_THREAD *, UINT)) param_1;
+ thread_entry_exit_notify = _txm_module_manager_thread_notify_trampoline;
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_entry_exit_notify(
+ (TX_THREAD *) param_0,
+ (VOID (*)(TX_THREAD *notify_thread_ptr, UINT type)) thread_entry_exit_notify
+ );
+ return(return_value);
+}
+
+/* TX_THREAD *_tx_thread_identify(); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_identify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_thread_identify();
+ return(return_value);
+}
+
+/* UINT _txe_thread_info_get(
+ TX_THREAD *thread_ptr, -> param_0
+ CHAR **name, -> param_1
+ UINT *state, -> extra_parameters[0]
+ ULONG *run_count, -> extra_parameters[1]
+ UINT *priority, -> extra_parameters[2]
+ UINT *preemption_threshold, -> extra_parameters[3]
+ ULONG *time_slice, -> extra_parameters[4]
+ TX_THREAD **next_thread, -> extra_parameters[5]
+ TX_THREAD **next_suspended_thread -> extra_parameters[6]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[5], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[6], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_info_get(
+ (TX_THREAD *) param_0,
+ (CHAR **) param_1,
+ (UINT *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (UINT *) extra_parameters[2],
+ (UINT *) extra_parameters[3],
+ (ULONG *) extra_parameters[4],
+ (TX_THREAD **) extra_parameters[5],
+ (TX_THREAD **) extra_parameters[6]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_thread_interrupt_control(
+ UINT new_posture -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_interrupt_control_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ return_value = (ALIGN_TYPE) _tx_thread_interrupt_control(
+ (UINT) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_thread_performance_info_get(
+ TX_THREAD *thread_ptr, -> param_0
+ ULONG *resumptions, -> param_1
+ ULONG *suspensions, -> extra_parameters[0]
+ ULONG *solicited_preemptions, -> extra_parameters[1]
+ ULONG *interrupt_preemptions, -> extra_parameters[2]
+ ULONG *priority_inversions, -> extra_parameters[3]
+ ULONG *time_slices, -> extra_parameters[4]
+ ULONG *relinquishes, -> extra_parameters[5]
+ ULONG *timeouts, -> extra_parameters[6]
+ ULONG *wait_aborts, -> extra_parameters[7]
+ TX_THREAD **last_preempted_by -> extra_parameters[8]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[5], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[6], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[7], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[8], sizeof(TX_THREAD *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_thread_performance_info_get(
+ (TX_THREAD *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4],
+ (ULONG *) extra_parameters[5],
+ (ULONG *) extra_parameters[6],
+ (ULONG *) extra_parameters[7],
+ (TX_THREAD **) extra_parameters[8]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_thread_performance_system_info_get(
+ ULONG *resumptions, -> param_0
+ ULONG *suspensions, -> param_1
+ ULONG *solicited_preemptions, -> extra_parameters[0]
+ ULONG *interrupt_preemptions, -> extra_parameters[1]
+ ULONG *priority_inversions, -> extra_parameters[2]
+ ULONG *time_slices, -> extra_parameters[3]
+ ULONG *relinquishes, -> extra_parameters[4]
+ ULONG *timeouts, -> extra_parameters[5]
+ ULONG *wait_aborts, -> extra_parameters[6]
+ ULONG *non_idle_returns, -> extra_parameters[7]
+ ULONG *idle_returns -> extra_parameters[8]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[4], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[5], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[6], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[7], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[8], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_thread_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3],
+ (ULONG *) extra_parameters[4],
+ (ULONG *) extra_parameters[5],
+ (ULONG *) extra_parameters[6],
+ (ULONG *) extra_parameters[7],
+ (ULONG *) extra_parameters[8]
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_preemption_change(
+ TX_THREAD *thread_ptr, -> param_0
+ UINT new_threshold, -> param_1
+ UINT *old_threshold -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_preemption_change_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_2, sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_preemption_change(
+ (TX_THREAD *) param_0,
+ (UINT) param_1,
+ (UINT *) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_priority_change(
+ TX_THREAD *thread_ptr, -> param_0
+ UINT new_priority, -> param_1
+ UINT *old_priority -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_priority_change_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_2, sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_priority_change(
+ (TX_THREAD *) param_0,
+ (UINT) param_1,
+ (UINT *) param_2
+ );
+ return(return_value);
+}
+
+/* VOID _txe_thread_relinquish(); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_relinquish_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ _txe_thread_relinquish();
+ return(TX_SUCCESS);
+}
+
+/* UINT _txe_thread_reset(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_reset_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_thread_reset(
+ (TX_THREAD *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_resume(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_resume_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_resume(
+ (TX_THREAD *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_thread_sleep(
+ ULONG timer_ticks -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_sleep_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_thread_sleep(
+ (ULONG) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_thread_stack_error_notify(
+ VOID (*stack_error_handler)(TX_THREAD *thread_ptr) -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_stack_error_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ return_value = (ALIGN_TYPE) _tx_thread_stack_error_notify(
+ (VOID (*)(TX_THREAD *thread_ptr)) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_suspend(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_suspend_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_suspend(
+ (TX_THREAD *) param_0
+ );
+ return(return_value);
+}
+
+/* VOID _tx_thread_system_suspend(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_system_suspend_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TX_THREAD *thread_ptr;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ /* Ensure the thread is suspending itself. */
+ if (((TX_THREAD *) param_0) != _tx_thread_current_ptr)
+ {
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ /* Get the thread pointer. */
+ thread_ptr = (TX_THREAD *) param_0;
+
+ /* Disable interrupts temporarily. */
+ TX_DISABLE
+
+ /* Set the status to suspending, in order to indicate the suspension
+ is in progress. */
+ thread_ptr -> tx_thread_state = TX_COMPLETED;
+
+ /* Thread state change. */
+ TX_THREAD_STATE_CHANGE(thread_ptr, TX_COMPLETED)
+
+ /* Set the suspending flag. */
+ thread_ptr -> tx_thread_suspending = TX_TRUE;
+
+ /* Setup for no timeout period. */
+ thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = 0;
+
+ /* Temporarily disable preemption. */
+ _tx_thread_preempt_disable++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Perform any additional activities for tool or user purpose. */
+ TX_THREAD_COMPLETED_EXTENSION(thread_ptr);
+
+ _tx_thread_system_suspend(
+ (TX_THREAD *) param_0
+ );
+ return(TX_SUCCESS);
+}
+
+/* UINT _txe_thread_terminate(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_terminate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_terminate(
+ (TX_THREAD *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_time_slice_change(
+ TX_THREAD *thread_ptr, -> param_0
+ ULONG new_time_slice, -> param_1
+ ULONG *old_time_slice -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_time_slice_change_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_2, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_time_slice_change(
+ (TX_THREAD *) param_0,
+ (ULONG) param_1,
+ (ULONG *) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_thread_wait_abort(
+ TX_THREAD *thread_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_thread_wait_abort_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_THREAD)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_thread_wait_abort(
+ (TX_THREAD *) param_0
+ );
+ return(return_value);
+}
+
+/* ULONG _tx_time_get(); */
+static ALIGN_TYPE _txm_module_manager_tx_time_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_time_get();
+ return(return_value);
+}
+
+/* VOID _tx_time_set(
+ ULONG new_time -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_time_set_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ _tx_time_set(
+ (ULONG) param_0
+ );
+ return(TX_SUCCESS);
+}
+
+/* UINT _txe_timer_activate(
+ TX_TIMER *timer_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_activate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_activate(
+ (TX_TIMER *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_timer_change(
+ TX_TIMER *timer_ptr, -> param_0
+ ULONG initial_ticks, -> param_1
+ ULONG reschedule_ticks -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_change_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_change(
+ (TX_TIMER *) param_0,
+ (ULONG) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txe_timer_create(
+ TX_TIMER *timer_ptr, -> param_0
+ CHAR *name_ptr, -> param_1
+ VOID (*expiration_function)(ULONG), -> extra_parameters[0]
+ ULONG expiration_input, -> extra_parameters[1]
+ ULONG initial_ticks, -> extra_parameters[2]
+ ULONG reschedule_ticks, -> extra_parameters[3]
+ UINT auto_activate, -> extra_parameters[4]
+ UINT timer_control_block_size -> extra_parameters[5]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_create_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+TX_TIMER *timer_ptr;
+VOID (*expiration_function)(ULONG);
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ /* Is it a disable request? */
+ if ((void *) extra_parameters[0] == TX_NULL)
+ {
+
+ /* Clear the callback. */
+ expiration_function = (VOID (*)(ULONG)) TX_NULL;
+ }
+ else
+ {
+
+ /* Set trampoline callback. */
+ expiration_function = _txm_module_manager_timer_notify_trampoline;
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_create(
+ (TX_TIMER *) param_0,
+ (CHAR *) param_1,
+ (VOID (*)(ULONG)) expiration_function,
+ (ULONG) extra_parameters[1],
+ (ULONG) extra_parameters[2],
+ (ULONG) extra_parameters[3],
+ (UINT) extra_parameters[4],
+ (UINT) extra_parameters[5]
+ );
+
+ if (return_value == TX_SUCCESS)
+ {
+
+ /* Get the object pointer. */
+ timer_ptr = (TX_TIMER *) param_0;
+
+ /* Setup trampoline values. */
+ if ((void *) extra_parameters[0] != TX_NULL)
+ {
+
+ timer_ptr -> tx_timer_module_instance = (VOID *) module_instance;
+ timer_ptr -> tx_timer_module_expiration_function = (VOID (*)(ULONG)) extra_parameters[0];
+ }
+ }
+ return(return_value);
+}
+
+/* UINT _txe_timer_deactivate(
+ TX_TIMER *timer_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_deactivate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_deactivate(
+ (TX_TIMER *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txe_timer_delete(
+ TX_TIMER *timer_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_delete_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_delete(
+ (TX_TIMER *) param_0
+ );
+
+ /* Deallocate object memory. */
+ if (return_value == TX_SUCCESS)
+ {
+ return_value = _txm_module_manager_object_deallocate((VOID *) param_0);
+ }
+ return(return_value);
+}
+
+/* UINT _txe_timer_info_get(
+ TX_TIMER *timer_ptr, -> param_0
+ CHAR **name, -> param_1
+ UINT *active, -> extra_parameters[0]
+ ULONG *remaining_ticks, -> extra_parameters[1]
+ ULONG *reschedule_ticks, -> extra_parameters[2]
+ TX_TIMER **next_timer -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(CHAR *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(UINT)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(TX_TIMER *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txe_timer_info_get(
+ (TX_TIMER *) param_0,
+ (CHAR **) param_1,
+ (UINT *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (TX_TIMER **) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_timer_performance_info_get(
+ TX_TIMER *timer_ptr, -> param_0
+ ULONG *activates, -> param_1
+ ULONG *reactivates, -> extra_parameters[0]
+ ULONG *deactivates, -> extra_parameters[1]
+ ULONG *expirations, -> extra_parameters[2]
+ ULONG *expiration_adjusts -> extra_parameters[3]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_performance_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, param_0, sizeof(TX_TIMER)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[3], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_timer_performance_info_get(
+ (TX_TIMER *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2],
+ (ULONG *) extra_parameters[3]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_timer_performance_system_info_get(
+ ULONG *activates, -> param_0
+ ULONG *reactivates, -> param_1
+ ULONG *deactivates, -> extra_parameters[0]
+ ULONG *expirations, -> extra_parameters[1]
+ ULONG *expiration_adjusts -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_timer_performance_system_info_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_1, sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[0], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[2], sizeof(ULONG)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _tx_timer_performance_system_info_get(
+ (ULONG *) param_0,
+ (ULONG *) param_1,
+ (ULONG *) extra_parameters[0],
+ (ULONG *) extra_parameters[1],
+ (ULONG *) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _tx_trace_buffer_full_notify(
+ VOID (*full_buffer_callback)(VOID *buffer) -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_buffer_full_notify_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_trace_buffer_full_notify(
+ (VOID (*)(VOID *buffer)) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_trace_disable(); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_disable_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ return_value = (ALIGN_TYPE) _tx_trace_disable();
+ return(return_value);
+}
+
+/* UINT _tx_trace_enable(
+ VOID *trace_buffer_start, -> param_0
+ ULONG trace_buffer_size, -> param_1
+ ULONG registry_entries -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_enable_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ return_value = (ALIGN_TYPE) _tx_trace_enable(
+ (VOID *) param_0,
+ (ULONG) param_1,
+ (ULONG) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _tx_trace_event_filter(
+ ULONG event_filter_bits -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_event_filter_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_trace_event_filter(
+ (ULONG) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_trace_event_unfilter(
+ ULONG event_unfilter_bits -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_event_unfilter_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_trace_event_unfilter(
+ (ULONG) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _tx_trace_interrupt_control(
+ UINT new_posture -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_interrupt_control_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ return_value = (ALIGN_TYPE) _tx_trace_interrupt_control(
+ (UINT) param_0
+ );
+ return(return_value);
+}
+
+/* VOID _tx_trace_isr_enter_insert(
+ ULONG isr_id -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_isr_enter_insert_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ _tx_trace_isr_enter_insert(
+ (ULONG) param_0
+ );
+ return(TX_SUCCESS);
+}
+
+/* VOID _tx_trace_isr_exit_insert(
+ ULONG isr_id -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_isr_exit_insert_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_USER_MODE)
+ return(TXM_MODULE_INVALID_PROPERTIES);
+
+ _tx_trace_isr_exit_insert(
+ (ULONG) param_0
+ );
+ return(TX_SUCCESS);
+}
+
+/* UINT _tx_trace_user_event_insert(
+ ULONG event_id, -> param_0
+ ULONG info_field_1, -> param_1
+ ULONG info_field_2, -> extra_parameters[0]
+ ULONG info_field_3, -> extra_parameters[1]
+ ULONG info_field_4 -> extra_parameters[2]
+ ); */
+static ALIGN_TYPE _txm_module_manager_tx_trace_user_event_insert_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ return_value = (ALIGN_TYPE) _tx_trace_user_event_insert(
+ (ULONG) param_0,
+ (ULONG) param_1,
+ (ULONG) extra_parameters[0],
+ (ULONG) extra_parameters[1],
+ (ULONG) extra_parameters[2]
+ );
+ return(return_value);
+}
+
+/* UINT _txm_module_object_allocate(
+ VOID **object_ptr, -> param_0
+ ULONG object_size -> param_1
+ ); */
+static ALIGN_TYPE _txm_module_manager_txm_module_object_allocate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_0, sizeof(VOID *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_object_allocate(
+ (VOID **) param_0,
+ (ULONG) param_1,
+ module_instance
+ );
+ return(return_value);
+}
+
+/* UINT _txm_module_object_deallocate(
+ VOID *object_ptr -> param_0
+ ); */
+static ALIGN_TYPE _txm_module_manager_txm_module_object_deallocate_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0)
+{
+
+ALIGN_TYPE return_value;
+TXM_MODULE_ALLOCATED_OBJECT *object_ptr;
+ALIGN_TYPE object_end;
+ALIGN_TYPE object_pool_end;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ /* Is the object pool created? */
+ if (_txm_module_manager_object_pool_created == TX_TRUE)
+ {
+
+ /* Get the module allocated object. */
+ object_ptr = ((TXM_MODULE_ALLOCATED_OBJECT *) param_0) - 1;
+
+ /* Get the end address of the object pool. */
+ object_pool_end = (ALIGN_TYPE) (_txm_module_manager_object_pool.tx_byte_pool_start + _txm_module_manager_object_pool.tx_byte_pool_size);
+
+ /* Check that the pointer is in the object pool. */
+ if ((ALIGN_TYPE) object_ptr < (ALIGN_TYPE) _txm_module_manager_object_pool.tx_byte_pool_start ||
+ (ALIGN_TYPE) object_ptr >= (ALIGN_TYPE) object_pool_end)
+ {
+ /* Pointer is outside of the object pool. */
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ /* Get the end addresses of the object. */
+ object_end = ((ALIGN_TYPE) object_ptr) + sizeof(TXM_MODULE_ALLOCATED_OBJECT) + object_ptr -> txm_module_object_size;
+
+ /* Check that the object is in the object pool. */
+ if (object_end >= object_pool_end)
+ {
+ /* Object is outside of the object pool. */
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+ }
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_object_deallocate(
+ (VOID *) param_0
+ );
+ return(return_value);
+}
+
+/* UINT _txm_module_object_pointer_get(
+ UINT object_type, -> param_0
+ CHAR *name, -> param_1
+ VOID **object_ptr -> param_2
+ ); */
+static ALIGN_TYPE _txm_module_manager_txm_module_object_pointer_get_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, param_2, sizeof(VOID *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_object_pointer_get(
+ (UINT) param_0,
+ (CHAR *) param_1,
+ (VOID **) param_2
+ );
+ return(return_value);
+}
+
+/* UINT _txm_module_object_pointer_get_extended(
+ UINT object_type, -> param_0
+ CHAR *name, -> param_1
+ UINT name_length, -> extra_parameters[0]
+ VOID **object_ptr -> extra_parameters[1]
+ ); */
+static ALIGN_TYPE _txm_module_manager_txm_module_object_pointer_get_extended_dispatch(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE *extra_parameters)
+{
+
+ALIGN_TYPE return_value;
+
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, param_1))
+ return(TXM_MODULE_INVALID_MEMORY);
+
+ if (!TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, extra_parameters[1], sizeof(VOID *)))
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ return_value = (ALIGN_TYPE) _txm_module_manager_object_pointer_get_extended(
+ (UINT) param_0,
+ (CHAR *) param_1,
+ (UINT) extra_parameters[0],
+ (VOID **) extra_parameters[1]
+ );
+ return(return_value);
+}
diff --git a/common_modules/module_manager/inc/txm_module_manager_util.h b/common_modules/module_manager/inc/txm_module_manager_util.h
new file mode 100644
index 00000000..05543294
--- /dev/null
+++ b/common_modules/module_manager/inc/txm_module_manager_util.h
@@ -0,0 +1,188 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* txm_module_manager_util.h PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file declares prototypes of utility functions used by the */
+/* module manager. */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+
+#ifndef TXM_MODULE_MANAGER_UTIL_H
+#define TXM_MODULE_MANAGER_UTIL_H
+
+/* Define utility macros. */
+
+/* Define inside/outside check macros. The _INCLUSIVE/_EXCLUSIVE suffix applies only to range_end. */
+
+#define TXM_MODULE_MANAGER_CHECK_OUTSIDE_RANGE_INCLUSIVE(range_start, range_end, obj_start, obj_size) \
+ ((obj_start) > (ALIGN_TYPE) (range_end) || \
+ ((obj_start) + (obj_size)) <= (ALIGN_TYPE) (range_start))
+
+#define TXM_MODULE_MANAGER_CHECK_OUTSIDE_RANGE_EXCLUSIVE(range_start, range_end, obj_start, obj_size) \
+ ((obj_start) >= (ALIGN_TYPE) (range_end) || \
+ ((obj_start) + (obj_size)) <= (ALIGN_TYPE) (range_start))
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE(range_start, range_end, obj_start, obj_size) \
+ (((obj_start) >= (ALIGN_TYPE) (range_start)) && \
+ (((obj_start) + (obj_size)) <= (ALIGN_TYPE) (range_end) + 1))
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE_BYTE(range_start, range_end, byte_ptr) \
+ (((byte_ptr) >= (ALIGN_TYPE) (range_start)) && \
+ ((byte_ptr) <= (ALIGN_TYPE) (range_end)))
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE(range_start, range_end, obj_start, obj_size) \
+ (((obj_start) >= (ALIGN_TYPE) (range_start)) && \
+ (((obj_start) + (obj_size)) <= (ALIGN_TYPE) (range_end)))
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE_BYTE(range_start, range_end, byte_ptr) \
+ (((byte_ptr) >= (ALIGN_TYPE) (range_start)) && \
+ ((byte_ptr) < (ALIGN_TYPE) (range_end)))
+
+/* Define check macros for modules. */
+
+#define TXM_MODULE_MANAGER_CHECK_OUTSIDE_DATA(module_instance, obj_ptr, obj_size) \
+ TXM_MODULE_MANAGER_CHECK_OUTSIDE_RANGE_INCLUSIVE(module_instance -> txm_module_instance_data_start, \
+ module_instance -> txm_module_instance_data_end, \
+ obj_ptr, obj_size)
+
+#define TXM_MODULE_MANAGER_CHECK_OUTSIDE_CODE(module_instance, obj_ptr, obj_size) \
+ TXM_MODULE_MANAGER_CHECK_OUTSIDE_RANGE_INCLUSIVE(module_instance -> txm_module_instance_code_start, \
+ module_instance -> txm_module_instance_code_end, \
+ obj_ptr, obj_size)
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_DATA(module_instance, obj_ptr, obj_size) \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE(module_instance -> txm_module_instance_data_start, \
+ module_instance -> txm_module_instance_data_end, \
+ obj_ptr, obj_size)
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_DATA_BYTE(module_instance, byte_ptr) \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE_BYTE(module_instance -> txm_module_instance_data_start, \
+ module_instance -> txm_module_instance_data_end, \
+ byte_ptr)
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_CODE(module_instance, obj_ptr, obj_size) \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE(module_instance -> txm_module_instance_code_start, \
+ module_instance -> txm_module_instance_code_end, \
+ obj_ptr, obj_size)
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_CODE_BYTE(module_instance, byte_ptr) \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_INCLUSIVE_BYTE(module_instance -> txm_module_instance_code_start, \
+ module_instance -> txm_module_instance_code_end, \
+ byte_ptr)
+
+#define TXM_MODULE_MANAGER_CHECK_INSIDE_OBJ_POOL(module_instance, obj_ptr, obj_size) \
+ ((_txm_module_manager_object_pool_created == TX_TRUE) && \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE(_txm_module_manager_object_pool.tx_byte_pool_start, \
+ _txm_module_manager_object_pool.tx_byte_pool_start + _txm_module_manager_object_pool.tx_byte_pool_size, \
+ obj_ptr, obj_size))
+
+/* Define macros for module. */
+
+#define TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE(module_instance, obj_ptr, obj_size) \
+ (TXM_MODULE_MANAGER_CHECK_INSIDE_DATA(module_instance, obj_ptr, obj_size) || \
+ _txm_module_manager_shared_memory_check_inside(module_instance, (ALIGN_TYPE) obj_ptr, obj_size) || \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_CODE(module_instance, obj_ptr, obj_size))
+
+#define TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE_BYTE(module_instance, byte_ptr) \
+ (TXM_MODULE_MANAGER_CHECK_INSIDE_DATA_BYTE(module_instance, byte_ptr) || \
+ _txm_module_manager_shared_memory_check_inside_byte(module_instance, (ALIGN_TYPE) byte_ptr) || \
+ TXM_MODULE_MANAGER_CHECK_INSIDE_CODE_BYTE(module_instance, byte_ptr))
+
+#define TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE_DATA(module_instance, obj_ptr, obj_size) \
+ (TXM_MODULE_MANAGER_CHECK_INSIDE_DATA(module_instance, obj_ptr, obj_size) || \
+ _txm_module_manager_shared_memory_check_inside(module_instance, (ALIGN_TYPE) obj_ptr, obj_size))
+
+#define TXM_MODULE_MANAGER_ENSURE_OUTSIDE_MODULE(module_instance, obj_ptr, obj_size) \
+ (TXM_MODULE_MANAGER_CHECK_OUTSIDE_DATA(module_instance, obj_ptr, obj_size) && \
+ _txm_module_manager_shared_memory_check_outside(module_instance, (ALIGN_TYPE) obj_ptr, obj_size) && \
+ TXM_MODULE_MANAGER_CHECK_OUTSIDE_CODE(module_instance, obj_ptr, obj_size))
+
+#define TXM_MODULE_MANAGER_ENSURE_INSIDE_OBJ_POOL(module_instance, obj_ptr, obj_size) \
+ (TXM_MODULE_MANAGER_CHECK_INSIDE_OBJ_POOL(module_instance, obj_ptr, obj_size))
+
+/* Define macros for parameter types. */
+
+/* Buffers we read from can be in RW/RO/Shared areas. */
+#define TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_READ(module_instance, buffer_ptr, buffer_size) \
+ (((void *) (buffer_ptr) == TX_NULL) || \
+ (TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE(module_instance, buffer_ptr, buffer_size)))
+
+/* Buffers we write to can only be in RW/Shared areas. */
+#define TXM_MODULE_MANAGER_PARAM_CHECK_BUFFER_WRITE(module_instance, buffer_ptr, buffer_size) \
+ (((void *) (buffer_ptr) == TX_NULL) || \
+ (TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE_DATA(module_instance, buffer_ptr, buffer_size)))
+
+/* Kernel objects should be outside the module at the very least. */
+#define TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, obj_ptr, obj_size) \
+ (((void *) (obj_ptr) == TX_NULL) || \
+ (TXM_MODULE_MANAGER_ENSURE_OUTSIDE_MODULE(module_instance, obj_ptr, obj_size)))
+
+/* When creating an object, the object must be inside the object pool. */
+#define TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, obj_ptr, obj_size) \
+ (((void *) (obj_ptr) == TX_NULL) || \
+ (TXM_MODULE_MANAGER_ENSURE_INSIDE_OBJ_POOL(module_instance, obj_ptr, obj_size) && \
+ (_txm_module_manager_object_size_check(obj_ptr, obj_size) == TX_SUCCESS)))
+
+/* Strings we dereference can be in RW/RO/Shared areas. */
+#define TXM_MODULE_MANAGER_PARAM_CHECK_DEREFERENCE_STRING(module_instance, string_ptr) \
+ (((void *) (string_ptr) == TX_NULL) || \
+ (TXM_MODULE_MANAGER_ENSURE_INSIDE_MODULE_BYTE(module_instance, string_ptr)))
+
+#define TXM_MODULE_MANAGER_UTIL_MAX_VALUE_OF_TYPE_UNSIGNED(type) ((1ULL << (sizeof(type) * 8)) - 1)
+
+#define TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(augend, addend, result) \
+ if ((ULONG)-1 - (augend) < (addend)) \
+ { \
+ return(TXM_MODULE_MATH_OVERFLOW); \
+ } \
+ else \
+ { \
+ (result) = (augend) + (addend); \
+ }
+
+/* Define utility functions. */
+
+UINT _txm_module_manager_object_memory_check(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE object_ptr, ULONG object_size);
+UINT _txm_module_manager_object_size_check(ALIGN_TYPE object_ptr, ULONG object_size);
+UINT _txm_module_manager_object_name_compare(CHAR *object_name1, UINT object_name1_length, CHAR *object_name2);
+UCHAR _txm_module_manager_created_object_check(TXM_MODULE_INSTANCE *module_instance, void *object_ptr);
+UINT _txm_module_manager_util_code_allocation_size_and_alignment_get(TXM_MODULE_PREAMBLE *module_preamble, ULONG *code_alignment_dest, ULONG *code_allocation_size_dest);
+
+#endif
diff --git a/common_modules/module_manager/src/txm_module_manager_application_request.c b/common_modules/module_manager/src/txm_module_manager_application_request.c
new file mode 100644
index 00000000..af7db561
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_application_request.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#include "tx_api.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_application_request PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the application-specific module request. */
+/* The entire contents of the request structure is application */
+/* specific and thus the processing in this file is left to the */
+/* application to define. */
+/* */
+/* INPUT */
+/* */
+/* request_id Module request ID */
+/* param_1 First parameter */
+/* param_2 Second parameter */
+/* param_3 Third parameter */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* _txm_module_manager_kernel_dispatch Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_application_request(ULONG request_id, ALIGN_TYPE param_1, ALIGN_TYPE param_2, ALIGN_TYPE param_3)
+{
+
+ /* By default, simply return the status of not available. */
+ return(TX_NOT_AVAILABLE);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_callback_request.c b/common_modules/module_manager/src/txm_module_manager_callback_request.c
new file mode 100644
index 00000000..ae7e8f15
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_callback_request.c
@@ -0,0 +1,176 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_queue.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_callback_request PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sends a notification callback function request to */
+/* the associated module. */
+/* */
+/* INPUT */
+/* */
+/* module_callback_queue Module callback request queue */
+/* callback_request Callback request */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* tx_queue_send Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_callback_request(TX_QUEUE *module_callback_queue, TXM_MODULE_CALLBACK_MESSAGE *callback_message)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_CALLBACK_MESSAGE *queued_message;
+UINT enqueued;
+UINT found;
+UINT status;
+
+
+ /* Lockout interrupts. */
+ TX_DISABLE
+
+ /* Determine if the queue is valid. */
+ if ((module_callback_queue) && (module_callback_queue -> tx_queue_id == TX_QUEUE_ID))
+ {
+
+ /* Yes, the queue is valid. */
+
+ /* Pickup the current callback request in the queue. */
+ queued_message = (TXM_MODULE_CALLBACK_MESSAGE *) module_callback_queue -> tx_queue_read;
+
+ /* Pickup the number of items enqueued. */
+ enqueued = module_callback_queue -> tx_queue_enqueued;
+
+ /* Set the found flag to false. */
+ found = TX_FALSE;
+
+ /* Loop to look for duplicates in the queue. */
+ while (enqueued != 0)
+ {
+
+ /* Does this entry match the new callback message? */
+ if ((queued_message -> txm_module_callback_message_application_function == callback_message -> txm_module_callback_message_application_function) &&
+ (queued_message -> txm_module_callback_message_param_1 == callback_message -> txm_module_callback_message_param_1) &&
+ (queued_message -> txm_module_callback_message_param_2 == callback_message -> txm_module_callback_message_param_2) &&
+ (queued_message -> txm_module_callback_message_param_3 == callback_message -> txm_module_callback_message_param_3) &&
+ (queued_message -> txm_module_callback_message_param_4 == callback_message -> txm_module_callback_message_param_4) &&
+ (queued_message -> txm_module_callback_message_param_5 == callback_message -> txm_module_callback_message_param_5) &&
+ (queued_message -> txm_module_callback_message_param_6 == callback_message -> txm_module_callback_message_param_6) &&
+ (queued_message -> txm_module_callback_message_param_7 == callback_message -> txm_module_callback_message_param_7) &&
+ (queued_message -> txm_module_callback_message_param_8 == callback_message -> txm_module_callback_message_param_8) &&
+ (queued_message -> txm_module_callback_message_reserved1 == callback_message -> txm_module_callback_message_reserved1) &&
+ (queued_message -> txm_module_callback_message_reserved2 == callback_message -> txm_module_callback_message_reserved2))
+ {
+
+ /* Update the activation count in the queued request. */
+ queued_message -> txm_module_callback_message_activation_count++;
+
+ /* Set the found flag to true. */
+ found = TX_TRUE;
+
+ /* Get out of the loop. */
+ break;
+ }
+
+ /* Decrease the number of messages to examine. */
+ enqueued--;
+
+ /* Move the callback message to the next message. */
+ queued_message++;
+
+ /* Check for wrap? */
+ if (((ULONG *) queued_message) >= module_callback_queue -> tx_queue_end)
+ {
+
+ /* Yes, set the queued message to the beginning of the queue. */
+ queued_message = (TXM_MODULE_CALLBACK_MESSAGE *) module_callback_queue -> tx_queue_start;
+ }
+ }
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Determine if we need to send the new callback request. */
+ if (found == TX_FALSE)
+ {
+
+ /* Yes, send the message. */
+ status = _tx_queue_send(module_callback_queue, (VOID *) callback_message, TX_NO_WAIT);
+
+ /* Determine if an error was detected. */
+ if (status != TX_SUCCESS)
+ {
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+ }
+ }
+
+ /* Increment the total number of callbacks. */
+ _txm_module_manager_callback_total_count++;
+ }
+ else
+ {
+
+ /* Module instance is not valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_event_flags_notify_trampoline.c b/common_modules/module_manager/src/txm_module_manager_event_flags_notify_trampoline.c
new file mode 100644
index 00000000..afaa9480
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_event_flags_notify_trampoline.c
@@ -0,0 +1,133 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+
+#include "tx_api.h"
+#include "tx_event_flags.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_event_flags_notify_trampoline PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the event flags set notification call from */
+/* ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* group_ptr Event flags group pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_callback_request Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_event_flags_notify_trampoline(TX_EVENT_FLAGS_GROUP *group_ptr)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+TX_QUEUE *module_callback_queue;
+
+
+ /* We now know the callback is for a module. */
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Pickup the module instance pointer. */
+ module_instance = (TXM_MODULE_INSTANCE *) group_ptr -> tx_event_flags_group_module_instance;
+
+ /* Determine if this module is still valid. */
+ if ((module_instance) && (module_instance -> txm_module_instance_id == TXM_MODULE_ID) &&
+ (module_instance -> txm_module_instance_state == TXM_MODULE_STARTED))
+ {
+
+ /* Yes, the module is still valid. */
+
+ /* Pickup the module's callback message queue. */
+ module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+
+ /* Build the queue notification message. */
+ callback_message.txm_module_callback_message_type = TXM_EVENTS_SET_CALLBACK;
+ callback_message.txm_module_callback_message_activation_count = 1;
+ callback_message.txm_module_callback_message_application_function = (VOID (*)(VOID)) group_ptr -> tx_event_flags_group_set_module_notify;
+ callback_message.txm_module_callback_message_param_1 = (ALIGN_TYPE) group_ptr;
+ callback_message.txm_module_callback_message_param_2 = 0;
+ callback_message.txm_module_callback_message_param_3 = 0;
+ callback_message.txm_module_callback_message_param_4 = 0;
+ callback_message.txm_module_callback_message_param_5 = 0;
+ callback_message.txm_module_callback_message_param_6 = 0;
+ callback_message.txm_module_callback_message_param_7 = 0;
+ callback_message.txm_module_callback_message_param_8 = 0;
+ callback_message.txm_module_callback_message_reserved1 = 0;
+ callback_message.txm_module_callback_message_reserved2 = 0;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Call the general processing that will place the callback on the
+ module's callback request queue. */
+ _txm_module_manager_callback_request(module_callback_queue, &callback_message);
+ }
+ else
+ {
+
+ /* Module no longer valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+#endif
diff --git a/common_modules/module_manager/src/txm_module_manager_file_load.c b/common_modules/module_manager/src/txm_module_manager_file_load.c
new file mode 100644
index 00000000..4508ec6c
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_file_load.c
@@ -0,0 +1,217 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#ifdef FX_FILEX_PRESENT
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_mutex.h"
+#include "tx_thread.h"
+#include "tx_byte_pool.h"
+#include "fx_api.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_file_load PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function reads the module preamble, allocates memory for */
+/* module code, loads the module code from the file, and calls */
+/* _txm_module_manager_internal_load to load the data and prepare the */
+/* module for execution. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* module_name Name of module */
+/* media_ptr FileX media pointer */
+/* file_name Name of module binary file */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* fx_file_close Close file */
+/* fx_file_open Open file */
+/* fx_file_read File read */
+/* fx_file_seek File seek */
+/* _tx_byte_allocate Allocate data area */
+/* _txm_module_manager_internal_load Load data and prepare module for */
+/* execution */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_file_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, FX_MEDIA *media_ptr, CHAR *file_name)
+{
+
+
+TXM_MODULE_PREAMBLE *module_preamble;
+FX_FILE module_file;
+TXM_MODULE_PREAMBLE preamble;
+ULONG code_start;
+ULONG code_size;
+ULONG code_alignment;
+ULONG code_allocation_size;
+CHAR *code_memory_ptr;
+UCHAR *destination_ptr;
+ULONG actual_size;
+UINT status;
+
+
+ /* Attempt to open the file. */
+ status = fx_file_open(media_ptr, &module_file, file_name, FX_OPEN_FOR_READ);
+
+ /* Check the file open status. */
+ if (status == FX_SUCCESS)
+ {
+
+ /* Read the preamble of the module. */
+ status = fx_file_read(&module_file, (VOID *) &preamble, sizeof(TXM_MODULE_PREAMBLE), &actual_size);
+
+ /* Check the file read status. */
+ if (status == FX_SUCCESS)
+ {
+
+ /* Check the number of bytes read. */
+ if (actual_size == sizeof(TXM_MODULE_PREAMBLE))
+ {
+
+ /* Pickup the module's information. */
+ module_preamble = (TXM_MODULE_PREAMBLE *) &preamble;
+
+ /* Pickup the module code size. */
+ code_size = module_preamble -> txm_module_preamble_code_size;
+
+ /* Check for valid sizes. */
+ if (code_size != 0)
+ {
+
+ /* Initialize module control block to all zeros. */
+ TX_MEMSET(module_instance, 0, sizeof(TXM_MODULE_INSTANCE));
+
+ /* Get the amount of the bytes we need to allocate for the module's code as well as the required alignment. */
+ status = _txm_module_manager_util_code_allocation_size_and_alignment_get(module_preamble, &code_alignment, &code_allocation_size);
+ if (status == TX_SUCCESS)
+ {
+
+ /* Allocate code memory for the module. */
+ status = _tx_byte_allocate(&_txm_module_manager_byte_pool, (VOID **) &code_memory_ptr, code_allocation_size, TX_NO_WAIT);
+
+ /* Determine if the module's code memory allocation was successful. */
+ if (status == TX_SUCCESS)
+ {
+
+ /* Prepare to read the module code into memory. */
+ code_start = (ULONG) code_memory_ptr;
+ code_start = (code_start + (code_alignment - 1)) & ~(code_alignment - 1);
+ destination_ptr = (UCHAR *) code_start;
+
+ /* Seek back to the beginning of the file. */
+ status = fx_file_seek(&module_file, 0);
+ if (status == FX_SUCCESS)
+ {
+
+ /* Read the module into memory. */
+ status = fx_file_read(&module_file, (VOID *) destination_ptr, code_size, &actual_size);
+ if (status == FX_SUCCESS)
+ {
+
+ /* Check the actual size read. */
+ if (actual_size == code_size)
+ {
+
+ /* At this point, the module's instruction area is now in the RAM code area. */
+
+ /* Now load it in-place. */
+ status = _txm_module_manager_internal_load(module_instance, module_name, (VOID *) code_start,
+ code_size, code_memory_ptr, code_allocation_size);
+ if (status == TX_SUCCESS)
+ {
+
+ /* Close the file. */
+ fx_file_close(&module_file);
+
+ /* Return success. */
+ return(TX_SUCCESS);
+ }
+ }
+ else
+ {
+
+ /* Invalid number of bytes read. */
+ status = TXM_MODULE_FILEX_INVALID_BYTES_READ;
+ }
+ }
+ }
+
+ /* Release the memory. */
+ _tx_byte_release(code_memory_ptr);
+ }
+ }
+ }
+ else
+ {
+
+ /* Invalid module preamble. */
+ status = TXM_MODULE_INVALID;
+ }
+ }
+ else
+ {
+
+ /* Invalid number of bytes read. */
+ status = TXM_MODULE_FILEX_INVALID_BYTES_READ;
+ }
+ }
+
+ /* Close the file. */
+ fx_file_close(&module_file);
+ }
+
+ /* Return success. */
+ return(status);
+}
+
+#endif
diff --git a/common_modules/module_manager/src/txm_module_manager_in_place_load.c b/common_modules/module_manager/src/txm_module_manager_in_place_load.c
new file mode 100644
index 00000000..d5ee4b55
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_in_place_load.c
@@ -0,0 +1,120 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_mutex.h"
+#include "tx_thread.h"
+#include "tx_byte_pool.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_in_place_load PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function ensures the code-related parts of the module preamble */
+/* are valid and calls _txm_module_manager_internal_load to load the */
+/* data and prepare the module for execution. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* module_name Module name pointer */
+/* module_location Module code location */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_internal_load Load data and prepare module for */
+/* execution */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_in_place_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
+{
+
+TXM_MODULE_PREAMBLE *module_preamble;
+ULONG code_size;
+ULONG code_alignment;
+ULONG code_allocation_size_ignored;
+UINT status;
+
+
+ /* Pickup the module's information. */
+ module_preamble = (TXM_MODULE_PREAMBLE *) module_location;
+
+ /* Pickup the basic module sizes. */
+ code_size = module_preamble -> txm_module_preamble_code_size;
+
+ /* Check for valid sizes. */
+ if (code_size == 0)
+ {
+
+ /* Invalid module preamble. */
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Get the amount of the bytes we need to allocate for the module's code
+ as well as the required alignment. Note that because this is an in-place
+ load, we only want the code alignment so we can check it. */
+ status = _txm_module_manager_util_code_allocation_size_and_alignment_get(module_preamble, &code_alignment, &code_allocation_size_ignored);
+ if (status != TX_SUCCESS)
+ {
+
+ /* Math overflow error occurred. */
+ return(status);
+ }
+
+ /* Since this is an in-place load, check the alignment of the module's instruction area (code). */
+ TXM_MODULE_MANAGER_CHECK_CODE_ALIGNMENT(module_location, code_alignment)
+
+ /* Now load the module in-place. */
+ status = _txm_module_manager_internal_load(module_instance, module_name, module_location,
+ code_size, TX_NULL, 0);
+
+ /* Return status. */
+ return(status);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_initialize.c b/common_modules/module_manager/src/txm_module_manager_initialize.c
new file mode 100644
index 00000000..1d9f19ab
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_initialize.c
@@ -0,0 +1,186 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+#define TX_MODULE_MANAGER_INIT
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_thread.h"
+#include "tx_byte_pool.h"
+#include "tx_queue.h"
+#include "tx_mutex.h"
+#include "txm_module.h"
+
+
+TXM_MODULE_MANAGER_VERSION_ID
+
+
+/* Define global variables associated with the module manager. */
+
+
+/* Define the module properties supported by this module manager. */
+
+ULONG _txm_module_manager_properties_supported;
+
+
+/* Define the module properties required by this module manager. */
+
+ULONG _txm_module_manager_properties_required;
+
+
+/* Define byte pool that will be used for allocating module data areas. */
+
+TX_BYTE_POOL _txm_module_manager_byte_pool;
+
+
+/* Define byte pool that will be used for allocating external memory for module objects. */
+
+TX_BYTE_POOL _txm_module_manager_object_pool;
+
+
+/* Define the flag indicating that the module manager byte pool is created. */
+
+UINT _txm_module_manager_object_pool_created;
+
+
+/* Define module manager protection mutex. */
+
+TX_MUTEX _txm_module_manager_mutex;
+
+
+/* Define the loaded modules list, which keeps track of all loaded modules. */
+
+TXM_MODULE_INSTANCE *_txm_module_manager_loaded_list_ptr;
+
+
+/* Define the count of loaded modules. */
+
+ULONG _txm_module_manger_loaded_count;
+
+
+/* Define the ready flag, which is checked by other module manager APIs
+ to make sure the manager has been initialized. */
+
+UINT _txm_module_manager_ready;
+
+
+/* Define the total callback activation count. This is simply incremented on every
+ callback activation. */
+
+ULONG _txm_module_manager_callback_total_count;
+
+
+/* Define the callback activation error count. This occurs when the available callback
+ structures have been exhausted. */
+
+ULONG _txm_module_manager_callback_error_count;
+
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_initialize PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function initializes the module manager. */
+/* */
+/* INPUT */
+/* */
+/* module_memory_start Start of module area */
+/* module_memory_size Size in bytes of module area */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_byte_pool_create Create module memory byte pool */
+/* _tx_mutex_create Create module manager */
+/* protection mutex */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_memory_size)
+{
+
+ /* Check for interrupt call. */
+ if (TX_THREAD_GET_SYSTEM_STATE() != 0)
+ {
+
+ /* Now, make sure the call is from an interrupt and not initialization. */
+ if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+ }
+
+ /* Setup the module properties supported by this module manager. */
+ _txm_module_manager_properties_supported = TXM_MODULE_MANAGER_SUPPORTED_OPTIONS;
+
+ /* Setup the module properties required by this module manager. */
+ _txm_module_manager_properties_required = TXM_MODULE_MANAGER_REQUIRED_OPTIONS;
+
+ /* Clear the module manager ready flag. */
+ _txm_module_manager_ready = TX_FALSE;
+
+ /* Initialize the empty module list. */
+ _txm_module_manager_loaded_list_ptr = TX_NULL;
+
+ /* Clear the number of loaded modules. */
+ _txm_module_manger_loaded_count = 0;
+
+ /* Create the module manager protection mutex. */
+ _tx_mutex_create(&_txm_module_manager_mutex, "Module Manager Protection Mutex", TX_NO_INHERIT);
+
+ /* Create a byte pool for allocating RAM areas for modules. */
+ _tx_byte_pool_create(&_txm_module_manager_byte_pool, "Module Manager Byte Pool", module_memory_start, module_memory_size);
+
+ /* Indicate the module manager object pool has not been created. */
+ _txm_module_manager_object_pool_created = TX_FALSE;
+
+ /* Mark the module manager as ready! */
+ _txm_module_manager_ready = TX_TRUE;
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_internal_load.c b/common_modules/module_manager/src/txm_module_manager_internal_load.c
new file mode 100644
index 00000000..3ba46d82
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_internal_load.c
@@ -0,0 +1,424 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_mutex.h"
+#include "tx_thread.h"
+#include "tx_byte_pool.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_internal_load PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function allocates data memory for module and prepares the */
+/* module for execution from the supplied code location. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* module_name Module name pointer */
+/* module_location Module code location */
+/* code_size Module code size */
+/* code_allocation_ptr Allocated code location */
+/* code_allocation_size Allocated code size */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_byte_allocate Allocate data area */
+/* _tx_mutex_get Get protection mutex */
+/* _tx_mutex_put Release protection mutex */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_internal_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location,
+ ULONG code_size, VOID *code_allocation_ptr, ULONG code_allocation_size)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_PREAMBLE *module_preamble;
+TXM_MODULE_INSTANCE *next_module, *previous_module;
+ULONG shell_function_adjust;
+ULONG start_function_adjust;
+ULONG stop_function_adjust;
+ULONG callback_function_adjust;
+ULONG start_stop_stack_size;
+ULONG callback_stack_size;
+ULONG code_size_ignored;
+ULONG code_alignment_ignored;
+ALIGN_TYPE data_start;
+ULONG data_size;
+ULONG data_alignment;
+ULONG data_allocation_size;
+ULONG module_properties;
+CHAR *memory_ptr;
+UINT status;
+
+
+ /* Check for interrupt call. */
+ if (TX_THREAD_GET_SYSTEM_STATE() != 0)
+ {
+
+ /* Now, make sure the call is from an interrupt and not initialization. */
+ if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+ }
+
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Get module manager protection mutex. */
+ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if the module is already valid. */
+ if (module_instance -> txm_module_instance_id == TXM_MODULE_ID)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Module already loaded. */
+ return(TXM_MODULE_ALREADY_LOADED);
+ }
+
+ /* Pickup the module's information. */
+ module_preamble = (TXM_MODULE_PREAMBLE *) module_location;
+
+ /* Check to make sure there is a valid module to load. */
+ if (module_preamble -> txm_module_preamble_id != TXM_MODULE_ID)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module preamble. */
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Check the properties of this module. */
+ module_properties = module_preamble -> txm_module_preamble_property_flags & TXM_MODULE_OPTIONS_MASK;
+ if (/* Ensure the requested properties are supported. */
+ ((module_properties & _txm_module_manager_properties_supported) != module_properties) ||
+ /* Ensure the required properties are there. */
+ ((_txm_module_manager_properties_required & module_properties) != _txm_module_manager_properties_required) ||
+ /* If memory protection is enabled, then so must user mode. */
+ ((module_properties & TXM_MODULE_MEMORY_PROTECTION) && !(module_properties & TXM_MODULE_USER_MODE))
+ )
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid properties. Return error. */
+ return(TXM_MODULE_INVALID_PROPERTIES);
+ }
+
+ /* Check for valid module entry offsets. */
+ if ((module_preamble -> txm_module_preamble_shell_entry_function == 0) ||
+ (module_preamble -> txm_module_preamble_start_function == 0))
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module preamble. */
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Check for valid sizes. */
+ if ((module_preamble -> txm_module_preamble_code_size == 0) ||
+ (module_preamble -> txm_module_preamble_data_size == 0) ||
+ (module_preamble -> txm_module_preamble_start_stop_stack_size == 0) ||
+ (module_preamble -> txm_module_preamble_callback_stack_size == 0))
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module preamble. */
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Initialize module control block to all zeros. */
+ TX_MEMSET(module_instance, 0, sizeof(TXM_MODULE_INSTANCE));
+
+ /* Pickup the basic module sizes. */
+ data_size = module_preamble -> txm_module_preamble_data_size;
+ start_stop_stack_size = module_preamble -> txm_module_preamble_start_stop_stack_size;
+ callback_stack_size = module_preamble -> txm_module_preamble_callback_stack_size;
+
+ /* Adjust the size of the module elements to be aligned to the default alignment. We do this
+ so that when we partition the allocated memory, we can simply place these regions right beside
+ each other without having to align their pointers. Note this only works when they all have
+ the same alignment. */
+
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(data_size, TXM_MODULE_DATA_ALIGNMENT, data_size);
+ data_size = ((data_size - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT;
+
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(start_stop_stack_size, TXM_MODULE_DATA_ALIGNMENT, start_stop_stack_size);
+ start_stop_stack_size = ((start_stop_stack_size - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT;
+
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(callback_stack_size, TXM_MODULE_DATA_ALIGNMENT, callback_stack_size);
+ callback_stack_size = ((callback_stack_size - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT;
+
+ /* Update the data size to account for the default thread stacks. */
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(data_size, start_stop_stack_size, data_size);
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(data_size, callback_stack_size, data_size);
+
+ /* Setup the default code and data alignments. */
+ data_alignment = (ULONG) TXM_MODULE_DATA_ALIGNMENT;
+
+ /* Get the port-specific alignment for the data size. Note we only want data
+ so we pass values of 1 for code (to avoid any possible div by 0 errors). */
+ code_size_ignored = 1;
+ code_alignment_ignored = 1;
+ TXM_MODULE_MANAGER_ALIGNMENT_ADJUST(module_preamble, code_size_ignored, code_alignment_ignored, data_size, data_alignment)
+
+ /* Calculate the module's total RAM memory requirement. This entire area is allocated from the module
+ manager's byte pool. The general layout is defined as follows:
+
+ Lowest Address: Start of start/stop thread stack
+ ... [note: thread entry info is embedded near end of stack areas]
+ End of start/stop thread stack
+
+ Start of callback thread stack
+ ... [note: thread entry info is embedded near end of stack areas]
+ End of callback thread stack
+
+ Module's Data Area
+ ...
+ End of Module's Data Area
+ Highest Address: */
+
+ /* Add an extra alignment increment so we can align the pointer after allocation. */
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(data_size, data_alignment, data_allocation_size);
+
+ /* Allocate memory for the module. */
+ status = _tx_byte_allocate(&_txm_module_manager_byte_pool, (VOID **) &memory_ptr, data_allocation_size, TX_NO_WAIT);
+
+ /* Determine if the module memory allocation was successful. */
+ if (status)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* No memory, return an error. */
+ return(TX_NO_MEMORY);
+ }
+
+ /* Clear the allocated memory. */
+ TX_MEMSET(memory_ptr, ((UCHAR) 0), data_allocation_size);
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Setup the module instance structure. */
+ module_instance -> txm_module_instance_id = TXM_MODULE_ID;
+
+ /* Save the module name. */
+ module_instance -> txm_module_instance_name = module_name;
+
+ /* Save the module properties. */
+ module_instance -> txm_module_instance_property_flags = module_preamble -> txm_module_preamble_property_flags;
+
+ /* Set the module data memory allocation. This is the address released
+ when the module is unloaded. */
+ module_instance -> txm_module_instance_data_allocation_ptr = (VOID *) memory_ptr;
+
+ /* Save the data allocation size. */
+ module_instance -> txm_module_instance_data_allocation_size = data_allocation_size;
+
+ /* Calculate the actual start of the data area. This needs to be adjusted based on the alignment. */
+ data_start = (ALIGN_TYPE) memory_ptr;
+ data_start = (data_start + (((ALIGN_TYPE)data_alignment) - 1)) & ~(((ALIGN_TYPE)data_alignment) - 1);
+ memory_ptr = (CHAR *) data_start;
+ module_instance -> txm_module_instance_data_start = (VOID *) memory_ptr;
+
+ /* Compute the end of the data memory allocation. */
+ module_instance -> txm_module_instance_data_end = (VOID *) (memory_ptr + (data_size - 1));
+
+ /* Save the size of the data area. */
+ module_instance -> txm_module_instance_data_size = data_size;
+
+ /* Set the module code memory allocation. This is the address released
+ when the module is unloaded. */
+ module_instance -> txm_module_instance_code_allocation_ptr = (VOID *) code_allocation_ptr;
+
+ /* Save the code allocation size. */
+ module_instance -> txm_module_instance_code_allocation_size = code_allocation_size;
+
+ /* Setup the code pointers. Since the code was loaded in-place, this is effectively just the values supplied in the API call. */
+ module_instance -> txm_module_instance_code_start = (VOID *) module_location;
+ module_instance -> txm_module_instance_code_end = (VOID *) (((CHAR *) module_location) + (code_size - 1));
+
+ /* Setup the code size. */
+ module_instance -> txm_module_instance_code_size = code_size;
+
+ /* Save the module's total memory usage. */
+ module_instance -> txm_module_instance_total_ram_usage = data_allocation_size + code_allocation_size;
+
+ /* Set the module state to started. */
+ module_instance -> txm_module_instance_state = TXM_MODULE_LOADED;
+
+ /* Save the preamble pointer. */
+ module_instance -> txm_module_instance_preamble_ptr = module_preamble;
+
+ /* Save the module application ID in the module instance. */
+ module_instance -> txm_module_instance_application_module_id = module_preamble -> txm_module_preamble_application_module_id;
+
+ /* Setup the module's start/stop thread stack area. */
+ module_instance -> txm_module_instance_start_stop_stack_start_address = (VOID *) (memory_ptr);
+ module_instance -> txm_module_instance_start_stop_stack_size = start_stop_stack_size;
+ module_instance -> txm_module_instance_start_stop_stack_end_address = (VOID *) (memory_ptr + (start_stop_stack_size - 1));
+
+ /* Move the memory pointer forward. */
+ memory_ptr = memory_ptr + start_stop_stack_size;
+
+ /* Save the start/stop thread priority. */
+ module_instance -> txm_module_instance_start_stop_priority = module_preamble -> txm_module_preamble_start_stop_priority;
+
+ /* Setup the module's callback thread stack area. */
+ module_instance -> txm_module_instance_callback_stack_start_address = (VOID *) (memory_ptr);
+ module_instance -> txm_module_instance_callback_stack_size = callback_stack_size;
+ module_instance -> txm_module_instance_callback_stack_end_address = (VOID *) (memory_ptr + (callback_stack_size - 1));
+
+ /* Move the memory pointer forward. */
+ memory_ptr = memory_ptr + callback_stack_size;
+
+ /* Save the callback thread priority. */
+ module_instance -> txm_module_instance_callback_priority = module_preamble -> txm_module_preamble_callback_priority;
+
+ /* Setup the start of the module data section. */
+ module_instance -> txm_module_instance_module_data_base_address = (VOID *) (memory_ptr);
+
+ /* Calculate the function adjustments based on the specific implementation of the module manager/module. */
+ TXM_MODULE_MANAGER_CALCULATE_ADJUSTMENTS(module_preamble -> txm_module_preamble_property_flags, shell_function_adjust, start_function_adjust, stop_function_adjust, callback_function_adjust)
+
+ /* Build actual addresses based on load... Setup all the function pointers. Any adjustments needed to shell entry, start function, and callback function are defined in the
+ module preamble. */
+ module_instance -> txm_module_instance_shell_entry_function = (VOID (*)(TX_THREAD *, TXM_MODULE_INSTANCE *)) (((CHAR *) module_instance -> txm_module_instance_code_start) +
+ (module_preamble -> txm_module_preamble_shell_entry_function) +
+ (shell_function_adjust));
+ module_instance -> txm_module_instance_start_thread_entry = (VOID (*)(ULONG)) (((CHAR *) module_instance -> txm_module_instance_code_start) +
+ (module_preamble -> txm_module_preamble_start_function) +
+ (start_function_adjust));
+ module_instance -> txm_module_instance_callback_request_thread_entry = (VOID (*)(ULONG)) (((CHAR *) module_instance -> txm_module_instance_code_start) +
+ (module_preamble -> txm_module_preamble_callback_function) +
+ (callback_function_adjust));
+ /* Determine if there is a stop function for this module. */
+ if (module_preamble -> txm_module_preamble_stop_function)
+ {
+
+ /* Yes, there is a stop function, build the address. */
+ module_instance -> txm_module_instance_stop_thread_entry = (VOID (*)(ULONG)) (((CHAR *) module_instance -> txm_module_instance_code_start) +
+ (module_preamble -> txm_module_preamble_stop_function) +
+ (stop_function_adjust));
+ }
+ else
+ {
+
+ /* No, there is no stop function. Just set the pointer to NULL. */
+ module_instance -> txm_module_instance_stop_thread_entry = TX_NULL;
+ }
+
+ /* Load the module control block with port-specific information. */
+ TXM_MODULE_MANAGER_MODULE_SETUP(module_instance);
+
+ /* Now add the module to the linked list of created modules. */
+ if (_txm_module_manger_loaded_count++ == 0)
+ {
+
+ /* The loaded module list is empty. Add module to empty list. */
+ _txm_module_manager_loaded_list_ptr = module_instance;
+ module_instance -> txm_module_instance_loaded_next = module_instance;
+ module_instance -> txm_module_instance_loaded_previous = module_instance;
+ }
+ else
+ {
+
+ /* This list is not NULL, add to the end of the list. */
+ next_module = _txm_module_manager_loaded_list_ptr;
+ previous_module = next_module -> txm_module_instance_loaded_previous;
+
+ /* Place the new module in the list. */
+ next_module -> txm_module_instance_loaded_previous = module_instance;
+ previous_module -> txm_module_instance_loaded_next = module_instance;
+
+ /* Setup this module's created links. */
+ module_instance -> txm_module_instance_loaded_previous = previous_module;
+ module_instance -> txm_module_instance_loaded_next = next_module;
+ }
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_kernel_dispatch.c b/common_modules/module_manager/src/txm_module_manager_kernel_dispatch.c
new file mode 100644
index 00000000..08761e17
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_kernel_dispatch.c
@@ -0,0 +1,741 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_block_pool.h"
+#include "tx_byte_pool.h"
+#include "tx_event_flags.h"
+#include "tx_queue.h"
+#include "tx_mutex.h"
+#include "tx_semaphore.h"
+#include "tx_thread.h"
+#include "tx_timer.h"
+#include "tx_trace.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+#include "txm_module_manager_dispatch.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_kernel_dispatch PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function dispatches the module's kernel request based upon the */
+/* ID and parameters specified in the request. */
+/* */
+/* INPUT */
+/* */
+/* kernel_request Module's kernel request */
+/* param_1 First parameter */
+/* param_2 Second parameter */
+/* param_3 Third parameter */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_application_request Application-specific req */
+/* _txm_module_manager_object_pointer_get Find object pointer */
+/* _txm_module_manager_thread_create Module thread create */
+/* [_txm_module_manager_*_dispatch] Optional external */
+/* component dispatch */
+/* ThreadX API Calls */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+ALIGN_TYPE _txm_module_manager_kernel_dispatch(ULONG kernel_request, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
+{
+
+ALIGN_TYPE return_value = TX_NOT_AVAILABLE;
+TXM_MODULE_INSTANCE *module_instance;
+
+
+ /* Get the module instance. */
+ module_instance = _tx_thread_current_ptr -> tx_thread_module_instance_ptr;
+
+ /* Sanity-check for a valid module instance. */
+ if (module_instance == TX_NULL)
+ {
+ /* Just return! */
+ return(TXM_MODULE_INVALID);
+ }
+
+ switch (kernel_request)
+ {
+ case TXM_BLOCK_ALLOCATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_allocate_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BLOCK_POOL_PRIORITIZE_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_pool_prioritize_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_BLOCK_RELEASE_CALL:
+ {
+ return_value = _txm_module_manager_tx_block_release_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_BYTE_ALLOCATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_allocate_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BYTE_POOL_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BYTE_POOL_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_BYTE_POOL_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BYTE_POOL_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_BYTE_POOL_PRIORITIZE_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_pool_prioritize_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_BYTE_RELEASE_CALL:
+ {
+ return_value = _txm_module_manager_tx_byte_release_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_create_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_SET_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_set_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_EVENT_FLAGS_SET_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_event_flags_set_notify_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_MUTEX_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_MUTEX_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_MUTEX_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_get_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_MUTEX_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_MUTEX_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_MUTEX_PRIORITIZE_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_prioritize_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_MUTEX_PUT_CALL:
+ {
+ return_value = _txm_module_manager_tx_mutex_put_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_QUEUE_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_QUEUE_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_QUEUE_FLUSH_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_flush_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_QUEUE_FRONT_SEND_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_front_send_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_QUEUE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_QUEUE_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_QUEUE_PRIORITIZE_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_prioritize_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_QUEUE_RECEIVE_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_receive_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_QUEUE_SEND_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_send_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_QUEUE_SEND_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_queue_send_notify_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_SEMAPHORE_CEILING_PUT_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_ceiling_put_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_SEMAPHORE_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_SEMAPHORE_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_SEMAPHORE_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_get_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_SEMAPHORE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_SEMAPHORE_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_SEMAPHORE_PRIORITIZE_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_prioritize_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_SEMAPHORE_PUT_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_put_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_SEMAPHORE_PUT_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_semaphore_put_notify_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_THREAD_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_ENTRY_EXIT_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_entry_exit_notify_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_THREAD_IDENTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_identify_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_INTERRUPT_CONTROL_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_interrupt_control_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_PREEMPTION_CHANGE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_preemption_change_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_THREAD_PRIORITY_CHANGE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_priority_change_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_THREAD_RELINQUISH_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_relinquish_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_THREAD_RESET_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_reset_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_RESUME_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_resume_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_SLEEP_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_sleep_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_STACK_ERROR_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_stack_error_notify_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_SUSPEND_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_suspend_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_SYSTEM_SUSPEND_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_system_suspend_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_TERMINATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_terminate_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_THREAD_TIME_SLICE_CHANGE_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_time_slice_change_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_THREAD_WAIT_ABORT_CALL:
+ {
+ return_value = _txm_module_manager_tx_thread_wait_abort_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TIME_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_time_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TIME_SET_CALL:
+ {
+ return_value = _txm_module_manager_tx_time_set_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TIMER_ACTIVATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_activate_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TIMER_CHANGE_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_change_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_TIMER_CREATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_create_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TIMER_DEACTIVATE_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_deactivate_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TIMER_DELETE_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_delete_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TIMER_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TIMER_PERFORMANCE_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_performance_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TIMER_PERFORMANCE_SYSTEM_INFO_GET_CALL:
+ {
+ return_value = _txm_module_manager_tx_timer_performance_system_info_get_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TRACE_BUFFER_FULL_NOTIFY_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_buffer_full_notify_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_DISABLE_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_disable_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_TRACE_ENABLE_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_enable_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_TRACE_EVENT_FILTER_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_event_filter_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_EVENT_UNFILTER_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_event_unfilter_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_INTERRUPT_CONTROL_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_interrupt_control_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_ISR_ENTER_INSERT_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_isr_enter_insert_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_ISR_EXIT_INSERT_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_isr_exit_insert_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_TRACE_USER_EVENT_INSERT_CALL:
+ {
+ return_value = _txm_module_manager_tx_trace_user_event_insert_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ case TXM_MODULE_OBJECT_ALLOCATE_CALL:
+ {
+ return_value = _txm_module_manager_txm_module_object_allocate_dispatch(module_instance, param_0, param_1);
+ break;
+ }
+
+ case TXM_MODULE_OBJECT_DEALLOCATE_CALL:
+ {
+ return_value = _txm_module_manager_txm_module_object_deallocate_dispatch(module_instance, param_0);
+ break;
+ }
+
+ case TXM_MODULE_OBJECT_POINTER_GET_CALL:
+ {
+ return_value = _txm_module_manager_txm_module_object_pointer_get_dispatch(module_instance, param_0, param_1, param_2);
+ break;
+ }
+
+ case TXM_MODULE_OBJECT_POINTER_GET_EXTENDED_CALL:
+ {
+ return_value = _txm_module_manager_txm_module_object_pointer_get_extended_dispatch(module_instance, param_0, param_1, (ALIGN_TYPE *) param_2);
+ break;
+ }
+
+ default:
+ {
+ /* Determine if an application request is present. */
+ if (kernel_request >= TXM_APPLICATION_REQUEST_ID_BASE)
+ {
+ /* Yes, call the module manager function that the application defines in order to
+ support application-specific requests. */
+ return_value = (ALIGN_TYPE) _txm_module_manager_application_request(kernel_request-TXM_APPLICATION_REQUEST_ID_BASE, param_0, param_1, param_2);
+ }
+
+#ifdef TXM_MODULE_ENABLE_NETX
+ /* Determine if there is a NetX request. */
+ else if ((kernel_request >= TXM_NETX_API_ID_START) && (kernel_request < TXM_NETX_API_ID_END))
+ {
+ /* Call the NetX module dispatch function. */
+ return_value = _txm_module_manager_netx_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+ /* Determine if there is a NetX Duo request. */
+ else if ((kernel_request >= TXM_NETXDUO_API_ID_START) && (kernel_request < TXM_NETXDUO_API_ID_END))
+ {
+ /* Call the NetX Duo module dispatch function. */
+ return_value = _txm_module_manager_netxduo_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+ /* Determine if there is a FileX request. */
+ else if ((kernel_request >= TXM_FILEX_API_ID_START) && (kernel_request < TXM_FILEX_API_ID_END))
+ {
+ /* Call the FileX module dispatch function. */
+ return_value = _txm_module_manager_filex_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+ /* Determine if there is a GUIX request. */
+ else if ((kernel_request >= TXM_GUIX_API_ID_START) && (kernel_request < TXM_GUIX_API_ID_END))
+ {
+ /* Call the GUIX module dispatch function. */
+ return_value = _txm_module_manager_guix_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+ /* Determine if there is a USBX request. */
+ else if ((kernel_request >= TXM_USBX_API_ID_START) && (kernel_request < TXM_USBX_API_ID_END))
+ {
+ /* Call the USBX dispatch function. */
+ return_value = _txm_module_manager_usbx_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
+ }
+#endif
+
+ /* Unhandled kernel request, return an error! */
+ break;
+ }
+ }
+
+ return(return_value);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_maximum_module_priority_set.c b/common_modules/module_manager/src/txm_module_manager_maximum_module_priority_set.c
new file mode 100644
index 00000000..dff40f9d
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_maximum_module_priority_set.c
@@ -0,0 +1,116 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_mutex.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_maximum_module_priority_set PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sets the maximum thread priority allowed in a module. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* priority Maximum thread priority */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_mutex_get Get protection mutex */
+/* _tx_mutex_put Release protection mutex */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_maximum_module_priority_set(TXM_MODULE_INSTANCE *module_instance, UINT priority)
+{
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Get module manager protection mutex. */
+ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if the module instance is valid. */
+ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
+ {
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Determine if the module instance is in the loaded state. */
+ if ((module_instance -> txm_module_instance_state != TXM_MODULE_LOADED) && (module_instance -> txm_module_instance_state != TXM_MODULE_STOPPED))
+ {
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return error if the module is not ready. */
+ return(TX_START_ERROR);
+ }
+
+
+ /* Set module's maximum priority. */
+ module_instance->txm_module_instance_maximum_priority = priority;
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ return(TX_SUCCESS);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_memory_load.c b/common_modules/module_manager/src/txm_module_manager_memory_load.c
new file mode 100644
index 00000000..dba896e7
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_memory_load.c
@@ -0,0 +1,162 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_mutex.h"
+#include "tx_thread.h"
+#include "tx_byte_pool.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_memory_load PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function allocates memory for module code and and calls */
+/* _txm_module_manager_internal_load to load the data and prepare the */
+/* module for execution. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* module_name Module name pointer */
+/* module_location Module code location */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_byte_allocate Allocate data area */
+/* _txm_module_manager_internal_load Load data and prepare module for */
+/* execution */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_memory_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
+{
+
+
+TXM_MODULE_PREAMBLE *module_preamble;
+ALIGN_TYPE code_start;
+ULONG code_size;
+ULONG code_alignment;
+ULONG code_allocation_size;
+CHAR *code_memory_ptr;
+UCHAR *source_ptr;
+UCHAR *destination_ptr;
+ULONG copy_size;
+ULONG i;
+UINT status;
+
+
+ /* Pickup the module's information. */
+ module_preamble = (TXM_MODULE_PREAMBLE *) module_location;
+
+ /* Pickup the basic module sizes. */
+ code_size = module_preamble -> txm_module_preamble_code_size;
+
+ /* Check for valid sizes. */
+ if (code_size == 0)
+ {
+
+ /* Invalid module preamble. */
+ return(TXM_MODULE_INVALID);
+ }
+
+ /* Get the amount of the bytes we need to allocate for the module's code as well as the required alignment. */
+ status = _txm_module_manager_util_code_allocation_size_and_alignment_get(module_preamble, &code_alignment, &code_allocation_size);
+ if (status != TX_SUCCESS)
+ {
+
+ /* Math overflow error occurred. */
+ return(status);
+ }
+
+ /* Allocate code memory for the module. */
+ status = _tx_byte_allocate(&_txm_module_manager_byte_pool, (VOID **) &code_memory_ptr, code_allocation_size, TX_NO_WAIT);
+
+ /* Determine if the module's code memory allocation was successful. */
+ if (status != TX_SUCCESS)
+ {
+
+ /* No memory, return an error. */
+ return(TX_NO_MEMORY);
+ }
+
+ /* Copy the module code into memory. */
+ source_ptr = (UCHAR *) module_location;
+ code_start = (ALIGN_TYPE) code_memory_ptr;
+ code_start = (code_start + (code_alignment - 1)) & ~(code_alignment - 1);
+ destination_ptr = (UCHAR *) code_start;
+
+ /* Calculate the size. */
+ copy_size = module_preamble -> txm_module_preamble_code_size;
+
+ /* Loop to copy the code to RAM. */
+ for (i = 0; i < copy_size; i++)
+ {
+
+ /* Copy one byte at a time. */
+ *destination_ptr++ = *source_ptr++;
+ }
+
+ /* At this point, the module's instruction area is now in the RAM code area. */
+
+ /* Now load it in-place. */
+ status = _txm_module_manager_internal_load(module_instance, module_name, (VOID *) code_start,
+ code_size, code_memory_ptr, code_allocation_size);
+ if (status != TX_SUCCESS)
+ {
+
+ /* Release code memory. */
+ _tx_byte_release(code_memory_ptr);
+
+ /* Return error. */
+ return(status);
+ }
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_object_allocate.c b/common_modules/module_manager/src/txm_module_manager_object_allocate.c
new file mode 100644
index 00000000..8b7dfadf
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_object_allocate.c
@@ -0,0 +1,155 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_allocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function allocates memory for an object from the memory pool */
+/* supplied to txm_module_manager_initialize. */
+/* */
+/* INPUT */
+/* */
+/* object_ptr Destination of object pointer on */
+/* successful allocation */
+/* object_size Size in bytes of the object to be */
+/* allocated */
+/* module_instance The module instance that the */
+/* object belongs to */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txe_mutex_get Get module instance mutex */
+/* _txe_mutex_put Release module instance mutex */
+/* _txe_byte_allocate Allocate object from pool */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_allocate(VOID **object_ptr_ptr, ULONG object_size, TXM_MODULE_INSTANCE *module_instance)
+{
+
+TXM_MODULE_ALLOCATED_OBJECT *object_ptr;
+UINT return_value;
+
+
+ /* Ensure the object pointer pointer is valid. */
+ if (object_ptr_ptr == (VOID **) TX_NULL)
+ {
+
+ /* The object pointer pointer is invalid, return an error. */
+ return(TXM_MODULE_INVALID_MEMORY);
+ }
+
+ /* Initialize the return pointer to NULL. */
+ *((VOID **) object_ptr_ptr) = TX_NULL;
+
+ /* Get module manager protection mutex. */
+ _txe_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if an object pool was created. */
+ if (_txm_module_manager_object_pool_created)
+ {
+
+ TXM_MODULE_ALLOCATED_OBJECT *next_object, *previous_object;
+
+ /* Allocate the object requested by the module - adding an extra ULONG in order to
+ store the module instance pointer. */
+ return_value = (ULONG) _txe_byte_allocate(&_txm_module_manager_object_pool, (VOID **) &object_ptr,
+ (ULONG) (object_size + sizeof(TXM_MODULE_ALLOCATED_OBJECT)), TX_NO_WAIT);
+
+ /* Determine if the request was successful. */
+ if (return_value == TX_SUCCESS)
+ {
+ /* Yes, now store the module instance in the allocated memory block. */
+
+ /* Link the allocated memory to the module instance. */
+ if (module_instance -> txm_module_instance_object_list_count++ == 0)
+ {
+ /* The allocated object list is empty. Add object to empty list. */
+ module_instance -> txm_module_instance_object_list_head = object_ptr;
+ object_ptr -> txm_module_allocated_object_next = object_ptr;
+ object_ptr -> txm_module_allocated_object_previous = object_ptr;
+ }
+ else
+ {
+ /* This list is not NULL, add to the end of the list. */
+ next_object = module_instance -> txm_module_instance_object_list_head;
+ previous_object = next_object -> txm_module_allocated_object_previous;
+
+ /* Place the new object in the list. */
+ next_object -> txm_module_allocated_object_previous = object_ptr;
+ previous_object -> txm_module_allocated_object_next = object_ptr;
+
+ /* Setup this object's allocated links. */
+ object_ptr -> txm_module_allocated_object_previous = previous_object;
+ object_ptr -> txm_module_allocated_object_next = next_object;
+ }
+
+ /* Setup the module instance pointer in the allocated object. */
+ object_ptr -> txm_module_allocated_object_module_instance = module_instance;
+
+ /* Set the object size. */
+ object_ptr -> txm_module_object_size = object_size;
+
+ /* Move the object pointer forward. This is what the module is given. */
+ object_ptr++;
+
+ /* Return this pointer to the application. */
+ *((VOID **) object_ptr_ptr) = object_ptr;
+ }
+ }
+ else
+ {
+ /* Set return value to not enabled. */
+ return_value = TX_NOT_AVAILABLE;
+ }
+
+ /* Release the protection mutex. */
+ _txe_mutex_put(&_txm_module_manager_mutex);
+
+ return(return_value);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_object_deallocate.c b/common_modules/module_manager/src/txm_module_manager_object_deallocate.c
new file mode 100644
index 00000000..c2a40185
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_object_deallocate.c
@@ -0,0 +1,138 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_deallocate PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function deallocates a previously allocated object. */
+/* */
+/* INPUT */
+/* */
+/* object_ptr Object pointer to deallocate */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txe_mutex_get Get module instance mutex */
+/* _txe_mutex_put Release module instance mutex */
+/* _txe_byte_release Release object back to pool */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_deallocate(VOID *object_ptr)
+{
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_ALLOCATED_OBJECT *module_allocated_object_ptr;
+UINT return_value;
+
+ /* Get module manager protection mutex. */
+ _txe_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if an object pool was created. */
+ if (_txm_module_manager_object_pool_created)
+ {
+
+ TXM_MODULE_ALLOCATED_OBJECT *next_object, *previous_object;
+
+ /* Pickup module instance pointer. */
+ module_instance = _tx_thread_current_ptr -> tx_thread_module_instance_ptr;
+
+ /* Setup the memory pointer. */
+ module_allocated_object_ptr = (TXM_MODULE_ALLOCATED_OBJECT *) object_ptr;
+
+ /* Position the object pointer backwards to position back to the module manager information. */
+ previous_object = module_allocated_object_ptr--;
+
+ /* Make sure the object is valid. */
+ if ((module_allocated_object_ptr == TX_NULL) || (module_allocated_object_ptr -> txm_module_allocated_object_module_instance != module_instance) || (module_instance -> txm_module_instance_object_list_count == 0))
+ {
+ /* Set return value to invalid pointer. */
+ return_value = TX_PTR_ERROR;
+ }
+ else
+ {
+
+ /* Unlink the node. */
+ if ((--module_instance -> txm_module_instance_object_list_count) == 0)
+ {
+ /* Only allocated object, just set the allocated list to NULL. */
+ module_instance -> txm_module_instance_object_list_head = TX_NULL;
+ }
+ else
+ {
+ /* Otherwise, not the only allocated object, link-up the neighbors. */
+ next_object = module_allocated_object_ptr -> txm_module_allocated_object_next;
+ previous_object = module_allocated_object_ptr -> txm_module_allocated_object_previous;
+ next_object -> txm_module_allocated_object_previous = previous_object;
+ previous_object -> txm_module_allocated_object_next = next_object;
+
+ /* See if we have to update the allocated object list head pointer. */
+ if (module_instance -> txm_module_instance_object_list_head == module_allocated_object_ptr)
+ {
+ /* Yes, move the head pointer to the next link. */
+ module_instance -> txm_module_instance_object_list_head = next_object;
+ }
+ }
+
+ /* Release the object memory. */
+ return_value = (ULONG) _txe_byte_release((VOID *) module_allocated_object_ptr);
+ }
+ }
+ else
+ {
+ /* Set return value to not enabled. */
+ return_value = TX_NOT_AVAILABLE;
+ }
+
+ /* Release the protection mutex. */
+ _txe_mutex_put(&_txm_module_manager_mutex);
+
+ return(return_value);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_object_pointer_get.c b/common_modules/module_manager/src/txm_module_manager_object_pointer_get.c
new file mode 100644
index 00000000..c1a95599
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_object_pointer_get.c
@@ -0,0 +1,91 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_pointer_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is deprecated and calls the secure version of this */
+/* function (_txm_module_manager_object_pointer_get_extended) with the */
+/* maximum possible name length since none was passed. */
+/* */
+/* INPUT */
+/* */
+/* object_type Type of object, as follows: */
+/* */
+/* TXM_BLOCK_POOL_OBJECT */
+/* TXM_BYTE_POOL_OBJECT */
+/* TXM_EVENT_FLAGS_OBJECT */
+/* TXM_MUTEX_OBJECT */
+/* TXM_QUEUE_OBJECT */
+/* TXM_SEMAPHORE_OBJECT */
+/* TXM_THREAD_OBJECT */
+/* TXM_TIMER_OBJECT */
+/* name Name to search for */
+/* object_ptr Pointer to the object */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SUCCESS Successful completion */
+/* TX_PTR_ERROR Invalid name or object ptr */
+/* TX_OPTION_ERROR Invalid option type */
+/* TX_NO_INSTANCE Object not found */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_object_pointer_get_extended */
+/* Secure version of this function */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_pointer_get(UINT object_type, CHAR *name, VOID **object_ptr)
+{
+
+UINT status;
+
+ /* Call the secure version of this function with the maximum length
+ possible since none was passed. */
+ status = _txm_module_manager_object_pointer_get_extended(object_type, name, TXM_MODULE_MANAGER_UTIL_MAX_VALUE_OF_TYPE_UNSIGNED(UINT), object_ptr);
+ return(status);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_object_pointer_get_extended.c b/common_modules/module_manager/src/txm_module_manager_object_pointer_get_extended.c
new file mode 100644
index 00000000..08583450
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_object_pointer_get_extended.c
@@ -0,0 +1,506 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_thread.h"
+#include "tx_timer.h"
+#include "tx_queue.h"
+#include "tx_event_flags.h"
+#include "tx_semaphore.h"
+#include "tx_mutex.h"
+#include "tx_block_pool.h"
+#include "tx_byte_pool.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_pointer_get_extended PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function retrieves the object pointer of a particular type */
+/* with a particular name. If the object is not found, an error is */
+/* returned. Otherwise, if the object is found, the address of that */
+/* object is placed in object_ptr. */
+/* */
+/* INPUT */
+/* */
+/* object_type Type of object, as follows: */
+/* */
+/* TXM_BLOCK_POOL_OBJECT */
+/* TXM_BYTE_POOL_OBJECT */
+/* TXM_EVENT_FLAGS_OBJECT */
+/* TXM_MUTEX_OBJECT */
+/* TXM_QUEUE_OBJECT */
+/* TXM_SEMAPHORE_OBJECT */
+/* TXM_THREAD_OBJECT */
+/* TXM_TIMER_OBJECT */
+/* search_name Name to search for */
+/* search_name_length Length of the name excluding */
+/* null-terminator */
+/* object_ptr Pointer to the object */
+/* */
+/* OUTPUT */
+/* */
+/* TX_SUCCESS Successful completion */
+/* TX_PTR_ERROR Invalid name or object ptr */
+/* TX_OPTION_ERROR Invalid option type */
+/* TX_NO_INSTANCE Object not found */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_object_name_compare */
+/* String compare routine */
+/* [_txm_module_manager_*_object_pointer_get] */
+/* Optional external component */
+/* object pointer get */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_pointer_get_extended(UINT object_type, CHAR *search_name, UINT search_name_length, VOID **object_ptr)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TX_THREAD *thread_ptr;
+TX_TIMER *timer_ptr;
+TX_QUEUE *queue_ptr;
+TX_EVENT_FLAGS_GROUP *events_ptr;
+TX_SEMAPHORE *semaphore_ptr;
+TX_MUTEX *mutex_ptr;
+TX_BLOCK_POOL *block_pool_ptr;
+TX_BYTE_POOL *byte_pool_ptr;
+ULONG i;
+UINT status;
+TXM_MODULE_INSTANCE *module_instance;
+
+
+ /* Determine if the name or object pointer are NULL. */
+ if ((search_name == TX_NULL) || (object_ptr == TX_NULL))
+ {
+
+ /* Return error! */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Default status to not found. */
+ status = TX_NO_INSTANCE;
+
+ /* Set the return value to NULL. */
+ *object_ptr = TX_NULL;
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Temporarily disable preemption. This will keep other threads from creating and deleting threads. */
+ _tx_thread_preempt_disable++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Process relative to the object type. */
+ switch(object_type)
+ {
+
+ /* Determine if a thread object is requested. */
+ case TXM_THREAD_OBJECT:
+ {
+
+ /* Loop to find the first matching thread. */
+ i = 0;
+ thread_ptr = _tx_thread_created_ptr;
+ while (i < _tx_thread_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, thread_ptr -> tx_thread_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) thread_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next thread. */
+ thread_ptr = thread_ptr -> tx_thread_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a timer object is requested. */
+ case TXM_TIMER_OBJECT:
+ {
+
+ /* Loop to find the first matching timer. */
+ i = 0;
+ timer_ptr = _tx_timer_created_ptr;
+ while (i < _tx_timer_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, timer_ptr -> tx_timer_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) timer_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next timer. */
+ timer_ptr = timer_ptr -> tx_timer_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a queue object is requested. */
+ case TXM_QUEUE_OBJECT:
+ {
+
+ /* Loop to find the first matching queue. */
+ i = 0;
+ queue_ptr = _tx_queue_created_ptr;
+ while (i < _tx_queue_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, queue_ptr -> tx_queue_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) queue_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next queue. */
+ queue_ptr = queue_ptr -> tx_queue_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a event flags object is requested. */
+ case TXM_EVENT_FLAGS_OBJECT:
+ {
+
+ /* Loop to find the first matching event flags group. */
+ i = 0;
+ events_ptr = _tx_event_flags_created_ptr;
+ while (i < _tx_event_flags_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, events_ptr -> tx_event_flags_group_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) events_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next event flags group. */
+ events_ptr = events_ptr -> tx_event_flags_group_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a semaphore object is requested. */
+ case TXM_SEMAPHORE_OBJECT:
+ {
+
+ /* Loop to find the first matching semaphore. */
+ i = 0;
+ semaphore_ptr = _tx_semaphore_created_ptr;
+ while (i < _tx_semaphore_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, semaphore_ptr -> tx_semaphore_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) semaphore_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next semaphore. */
+ semaphore_ptr = semaphore_ptr -> tx_semaphore_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a mutex object is requested. */
+ case TXM_MUTEX_OBJECT:
+ {
+
+ /* Loop to find the first matching mutex. */
+ i = 0;
+ mutex_ptr = _tx_mutex_created_ptr;
+ while (i < _tx_mutex_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, mutex_ptr -> tx_mutex_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) mutex_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next mutex. */
+ mutex_ptr = mutex_ptr -> tx_mutex_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a block pool object is requested. */
+ case TXM_BLOCK_POOL_OBJECT:
+ {
+
+ /* Get the module instance. */
+ module_instance = _tx_thread_current_ptr -> tx_thread_module_instance_ptr;
+
+ /* Is a module making this request? */
+ if (module_instance != TX_NULL)
+ {
+
+ /* Is memory protection enabled? */
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+
+ /* Modules with memory protection can only access block pools they created. */
+ status = TXM_MODULE_INVALID;
+ break;
+ }
+ }
+
+ /* Loop to find the first matching block pool. */
+ i = 0;
+ block_pool_ptr = _tx_block_pool_created_ptr;
+ while (i < _tx_block_pool_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, block_pool_ptr -> tx_block_pool_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) block_pool_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next block pool. */
+ block_pool_ptr = block_pool_ptr -> tx_block_pool_created_next;
+ }
+ break;
+ }
+
+ /* Determine if a byte pool object is requested. */
+ case TXM_BYTE_POOL_OBJECT:
+ {
+
+ /* Get the module instance. */
+ module_instance = _tx_thread_current_ptr -> tx_thread_module_instance_ptr;
+
+ /* Is a module making this request? */
+ if (module_instance != TX_NULL)
+ {
+
+ /* Is memory protection enabled? */
+ if (module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION)
+ {
+
+ /* Modules with memory protection can only access block pools they created. */
+ status = TXM_MODULE_INVALID;
+ break;
+ }
+ }
+
+ /* Loop to find the first matching byte pool. */
+ i = 0;
+ byte_pool_ptr = _tx_byte_pool_created_ptr;
+ while (i < _tx_byte_pool_created_count)
+ {
+
+ /* Do we have a match? */
+ if (_txm_module_manager_object_name_compare(search_name, search_name_length, byte_pool_ptr -> tx_byte_pool_name))
+ {
+
+ /* Yes, we found it - return the necessary info! */
+ *object_ptr = (VOID *) byte_pool_ptr;
+
+ /* Set the the status to success! */
+ status = TX_SUCCESS;
+ break;
+ }
+
+ /* Increment the counter. */
+ i++;
+
+ /* Move to next byte pool. */
+ byte_pool_ptr = byte_pool_ptr -> tx_byte_pool_created_next;
+ }
+ break;
+ }
+
+ default:
+
+ /* Invalid object ID. */
+ status = TX_OPTION_ERROR;
+
+ /* External Object pointer get. */
+
+#ifdef TXM_MODULE_ENABLE_NETX
+
+ /* Determine if there is a NetX object get request. */
+ if ((object_type >= TXM_NETX_OBJECTS_START) && (object_type < TXM_NETX_OBJECTS_END))
+ {
+
+ /* Call the NetX module object get function. */
+ status = _txm_module_manager_netx_object_pointer_get(object_type, search_name, search_name_length, object_ptr);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+
+ /* Determine if there is a NetX Duo object get request. */
+ if ((object_type >= TXM_NETXDUO_OBJECTS_START) && (object_type < TXM_NETXDUO_OBJECTS_END))
+ {
+
+ /* Call the NetX Duo module object get function. */
+ status = _txm_module_manager_netxduo_object_pointer_get(object_type, search_name, search_name_length, object_ptr);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+
+ /* Determine if there is a FileX object get request. */
+ if ((object_type >= TXM_FILEX_OBJECTS_START) && (object_type < TXM_FILEX_OBJECTS_END))
+ {
+
+ /* Call the FileX module object get function. */
+ status = _txm_module_manager_filex_object_pointer_get(object_type, search_name, search_name_length, object_ptr);
+ }
+#endif
+
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+
+ /* Determine if there is a GUIX object get request. */
+ if ((object_type >= TXM_GUIX_OBJECTS_START) && (object_type < TXM_GUIX_OBJECTS_END))
+ {
+
+ /* Call the GUIX module object get function. */
+ status = _txm_module_manager_guix_object_pointer_get(object_type, search_name, search_name_length, object_ptr);
+ }
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+
+ /* Determine if there is a USBX object get request. */
+ if ((object_type >= TXM_USBX_OBJECTS_START) && (object_type < TXM_USBX_OBJECTS_END))
+ {
+
+ /* Call the USBX object get function. */
+ status = _txm_module_manager_usbx_object_pointer_get(object_type, search_name, search_name_length, object_ptr);
+ }
+#endif
+
+ break;
+ }
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Enable preemption again. */
+ _tx_thread_preempt_disable--;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Check for preemption. */
+ _tx_thread_system_preempt_check();
+
+ /* Return success. */
+ return(status);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_object_pool_create.c b/common_modules/module_manager/src/txm_module_manager_object_pool_create.c
new file mode 100644
index 00000000..9794ec98
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_object_pool_create.c
@@ -0,0 +1,82 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "txm_module.h"
+#include "tx_byte_pool.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* txm_module_manager_object_pool_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates an object pool for the module manager, */
+/* which is used by modules to allocate system resources outside */
+/* the memory area of the module. This is especially useful in */
+/* memory protection. */
+/* */
+/* INPUT */
+/* */
+/* object_memory Object memory address */
+/* object_memory_size Size in bytes of memory area */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_byte_pool_create Create module memory byte pool */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_pool_create(VOID *object_memory, ULONG object_memory_size)
+{
+
+ /* Create a byte pool for allocating RAM areas for modules. */
+ _tx_byte_pool_create(&_txm_module_manager_object_pool, "Module Manager Object Pool", object_memory, object_memory_size);
+
+ /* Indicate the module manager object pool has been created. */
+ _txm_module_manager_object_pool_created = TX_TRUE;
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_properties_get.c b/common_modules/module_manager/src/txm_module_manager_properties_get.c
new file mode 100644
index 00000000..f2f803c5
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_properties_get.c
@@ -0,0 +1,106 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_properties_get PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the properties of the specified module so they*/
+/* may be checked before executing the module. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_properties_get(TXM_MODULE_INSTANCE *module_instance, ULONG *module_properties_ptr)
+{
+
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Check the module ID. */
+ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Check for non-null buffer. */
+ if (module_properties_ptr == TX_NULL)
+ {
+
+ /* Invalid buffer pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Simply return the property bitmap. */
+ *module_properties_ptr = module_instance -> txm_module_instance_property_flags;
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_queue_notify_trampoline.c b/common_modules/module_manager/src/txm_module_manager_queue_notify_trampoline.c
new file mode 100644
index 00000000..50166517
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_queue_notify_trampoline.c
@@ -0,0 +1,132 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_queue.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_queue_notify_trampoline PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the queue notification call from ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Queue pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_callback_request Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_queue_notify_trampoline(TX_QUEUE *queue_ptr)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+TX_QUEUE *module_callback_queue;
+
+
+ /* We now know the callback is for a module. */
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Pickup the module instance pointer. */
+ module_instance = (TXM_MODULE_INSTANCE *) queue_ptr -> tx_queue_module_instance;
+
+ /* Determine if this module is still valid. */
+ if ((module_instance) && (module_instance -> txm_module_instance_id == TXM_MODULE_ID) &&
+ (module_instance -> txm_module_instance_state == TXM_MODULE_STARTED))
+ {
+
+ /* Yes, the module is still valid. */
+
+ /* Pickup the module's callback message queue. */
+ module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+
+ /* Build the queue notification message. */
+ callback_message.txm_module_callback_message_type = TXM_QUEUE_SEND_CALLBACK;
+ callback_message.txm_module_callback_message_activation_count = 1;
+ callback_message.txm_module_callback_message_application_function = (VOID (*)(VOID)) queue_ptr -> tx_queue_send_module_notify;
+ callback_message.txm_module_callback_message_param_1 = (ALIGN_TYPE) queue_ptr;
+ callback_message.txm_module_callback_message_param_2 = 0;
+ callback_message.txm_module_callback_message_param_3 = 0;
+ callback_message.txm_module_callback_message_param_4 = 0;
+ callback_message.txm_module_callback_message_param_5 = 0;
+ callback_message.txm_module_callback_message_param_6 = 0;
+ callback_message.txm_module_callback_message_param_7 = 0;
+ callback_message.txm_module_callback_message_param_8 = 0;
+ callback_message.txm_module_callback_message_reserved1 = 0;
+ callback_message.txm_module_callback_message_reserved2 = 0;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Call the general processing that will place the callback on the
+ module's callback request queue. */
+ _txm_module_manager_callback_request(module_callback_queue, &callback_message);
+ }
+ else
+ {
+
+ /* Module no longer valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+#endif
+
+
diff --git a/common_modules/module_manager/src/txm_module_manager_semaphore_notify_trampoline.c b/common_modules/module_manager/src/txm_module_manager_semaphore_notify_trampoline.c
new file mode 100644
index 00000000..78f6f157
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_semaphore_notify_trampoline.c
@@ -0,0 +1,131 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_queue.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_semaphore_notify_trampoline PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the semaphore put notification call from */
+/* ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* semaphore_ptr Semaphore pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_callback_request Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_semaphore_notify_trampoline(TX_SEMAPHORE *semaphore_ptr)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+TX_QUEUE *module_callback_queue;
+
+
+ /* We now know the callback is for a module. */
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Pickup the module instance pointer. */
+ module_instance = (TXM_MODULE_INSTANCE *) semaphore_ptr -> tx_semaphore_module_instance;
+
+ /* Determine if this module is still valid. */
+ if ((module_instance) && (module_instance -> txm_module_instance_id == TXM_MODULE_ID) &&
+ (module_instance -> txm_module_instance_state == TXM_MODULE_STARTED))
+ {
+
+ /* Yes, the module is still valid. */
+
+ /* Pickup the module's callback message queue. */
+ module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+
+ /* Build the queue notification message. */
+ callback_message.txm_module_callback_message_type = TXM_SEMAPHORE_PUT_CALLBACK;
+ callback_message.txm_module_callback_message_activation_count = 1;
+ callback_message.txm_module_callback_message_application_function = (VOID (*)(VOID)) semaphore_ptr -> tx_semaphore_put_module_notify;
+ callback_message.txm_module_callback_message_param_1 = (ALIGN_TYPE) semaphore_ptr;
+ callback_message.txm_module_callback_message_param_2 = 0;
+ callback_message.txm_module_callback_message_param_3 = 0;
+ callback_message.txm_module_callback_message_param_4 = 0;
+ callback_message.txm_module_callback_message_param_5 = 0;
+ callback_message.txm_module_callback_message_param_6 = 0;
+ callback_message.txm_module_callback_message_param_7 = 0;
+ callback_message.txm_module_callback_message_param_8 = 0;
+ callback_message.txm_module_callback_message_reserved1 = 0;
+ callback_message.txm_module_callback_message_reserved2 = 0;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Call the general processing that will place the callback on the
+ module's callback request queue. */
+ _txm_module_manager_callback_request(module_callback_queue, &callback_message);
+ }
+ else
+ {
+
+ /* Module no longer valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+#endif
diff --git a/common_modules/module_manager/src/txm_module_manager_start.c b/common_modules/module_manager/src/txm_module_manager_start.c
new file mode 100644
index 00000000..df689247
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_start.c
@@ -0,0 +1,226 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_mutex.h"
+#include "tx_queue.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_start PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function starts execution of the specified module. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_name_build Build module:thread name */
+/* _txm_module_manager_thread_create Module thread create */
+/* _tx_mutex_get Get protection mutex */
+/* _tx_mutex_put Release protection mutex */
+/* _tx_queue_create Create module callback queue */
+/* _tx_queue_delete Delete module callback queue */
+/* _tx_thread_resume Resume start thread */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_start(TXM_MODULE_INSTANCE *module_instance)
+{
+
+UINT status;
+
+
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Get module manager protection mutex. */
+ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if the module instance is valid. */
+ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Determine if the module instance is in the loaded state. */
+ if ((module_instance -> txm_module_instance_state != TXM_MODULE_LOADED) && (module_instance -> txm_module_instance_state != TXM_MODULE_STOPPED))
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return error if the module is not ready. */
+ return(TX_START_ERROR);
+ }
+
+ /* Check the priorities of the start/stop and callback request threads. */
+ if (module_instance -> txm_module_instance_start_stop_priority < module_instance -> txm_module_instance_maximum_priority ||
+ module_instance -> txm_module_instance_callback_priority < module_instance -> txm_module_instance_maximum_priority)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* At least one thread has an invalid priority. */
+ return(TX_PRIORITY_ERROR);
+ }
+
+ /* Create the module's callback request queue. */
+ status = _tx_queue_create(&(module_instance -> txm_module_instance_callback_request_queue), "Module Callback Request Queue", (sizeof(TXM_MODULE_CALLBACK_MESSAGE)/sizeof(ULONG)),
+ module_instance -> txm_module_instance_callback_request_queue_area, sizeof(module_instance -> txm_module_instance_callback_request_queue_area));
+
+ /* Determine if there was an error. */
+ if (status)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return error if the module is not ready. */
+ return(TX_START_ERROR);
+ }
+
+ /* Create the module start thread. */
+ status = _txm_module_manager_thread_create(&(module_instance -> txm_module_instance_start_stop_thread),
+ "Module Start Thread",
+ module_instance -> txm_module_instance_shell_entry_function,
+ module_instance -> txm_module_instance_start_thread_entry,
+ module_instance -> txm_module_instance_application_module_id,
+ module_instance -> txm_module_instance_start_stop_stack_start_address,
+ module_instance -> txm_module_instance_start_stop_stack_size,
+ (UINT) module_instance -> txm_module_instance_start_stop_priority,
+ (UINT) module_instance -> txm_module_instance_start_stop_priority,
+ TXM_MODULE_TIME_SLICE,
+ TX_DONT_START,
+ sizeof(TX_THREAD),
+ module_instance);
+
+ /* Determine if the thread create was successful. */
+ if (status != TX_SUCCESS)
+ {
+
+ /* Delete the callback notification queue. */
+ _tx_queue_delete(&(module_instance -> txm_module_instance_callback_request_queue));
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return the error status. */
+ return(status);
+ }
+
+ /* Create the module callback thread. */
+ status = _txm_module_manager_thread_create(&(module_instance -> txm_module_instance_callback_request_thread),
+ "Module Callback Request Thread",
+ module_instance -> txm_module_instance_shell_entry_function,
+ module_instance -> txm_module_instance_callback_request_thread_entry,
+ module_instance -> txm_module_instance_application_module_id,
+ module_instance -> txm_module_instance_callback_stack_start_address,
+ module_instance -> txm_module_instance_callback_stack_size,
+ (UINT) module_instance -> txm_module_instance_callback_priority,
+ (UINT) module_instance -> txm_module_instance_callback_priority,
+ TX_NO_TIME_SLICE,
+ TX_DONT_START,
+ sizeof(TX_THREAD),
+ module_instance);
+
+ /* Determine if the thread create was successful. */
+ if (status != TX_SUCCESS)
+ {
+
+ /* Terminate the start thread. */
+ _tx_thread_terminate(&(module_instance -> txm_module_instance_start_stop_thread));
+
+ /* Delete the start thread. */
+ _tx_thread_delete(&(module_instance -> txm_module_instance_start_stop_thread));
+
+ /* Delete the callback notification queue. */
+ _tx_queue_delete(&(module_instance -> txm_module_instance_callback_request_queue));
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return the error status. */
+ return(status);
+ }
+
+
+ /* Set the module state to started. */
+ module_instance -> txm_module_instance_state = TXM_MODULE_STARTED;
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Resume the module's start thread. */
+ _tx_thread_resume(&(module_instance -> txm_module_instance_start_stop_thread));
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_stop.c b/common_modules/module_manager/src/txm_module_manager_stop.c
new file mode 100644
index 00000000..b9682a1d
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_stop.c
@@ -0,0 +1,571 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_initialize.h"
+#include "tx_thread.h"
+#include "tx_timer.h"
+#include "tx_queue.h"
+#include "tx_event_flags.h"
+#include "tx_semaphore.h"
+#include "tx_mutex.h"
+#include "tx_block_pool.h"
+#include "tx_byte_pool.h"
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+extern UINT _txm_module_manager_filex_stop(TXM_MODULE_INSTANCE *module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETX
+extern UINT _txm_module_manager_netx_stop(TXM_MODULE_INSTANCE *module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+extern UINT _txm_module_manager_netxduo_stop(TXM_MODULE_INSTANCE *module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+extern UINT _txm_module_manager_guix_stop(TXM_MODULE_INSTANCE *module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+extern UINT _txm_module_manager_usbx_stop(TXM_MODULE_INSTANCE *module_instance);
+#endif
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_stop PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function stops execution of the specified module. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_block_pool_delete Block pool delete */
+/* _tx_byte_pool_delete Byte pool delete */
+/* _tx_event_flags_delete Event flags delete */
+/* _tx_mutex_delete Mutex delete */
+/* _tx_mutex_get Get protection mutex */
+/* _tx_mutex_put Release protection mutex */
+/* _tx_queue_delete Queue delete */
+/* _tx_semaphore_delete Semaphore delete */
+/* _tx_thread_delete Thread delete */
+/* _tx_thread_sleep Thread sleep */
+/* _tx_thread_system_preempt_check Check for preemption */
+/* _tx_thread_terminate Thread terminate */
+/* _tx_timer_delete Timer delete */
+/* _txm_module_manager_callback_deactivate */
+/* Deactivate callback */
+/* _txm_module_manager_object_search Search for object in module's */
+/* allocated object list */
+/* _txm_module_manager_thread_create Module thread create */
+/* [_txm_module_manager_*_stop] Optional external component */
+/* stop functions */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_stop(TXM_MODULE_INSTANCE *module_instance)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TX_THREAD *thread_ptr, *next_thread_ptr;
+TX_TIMER *timer_ptr, *next_timer_ptr;
+TX_QUEUE *queue_ptr, *next_queue_ptr;
+TX_EVENT_FLAGS_GROUP *events_ptr, *next_events_ptr;
+TX_SEMAPHORE *semaphore_ptr, *next_semaphore_ptr;
+TX_MUTEX *mutex_ptr, *next_mutex_ptr;
+TX_BLOCK_POOL *block_pool_ptr, *next_block_pool_ptr;
+TX_BYTE_POOL *byte_pool_ptr, *next_byte_pool_ptr;
+UCHAR created_by_module;
+ULONG i;
+TXM_MODULE_ALLOCATED_OBJECT *object_ptr;
+
+
+ /* Pickup thread pointer. */
+ TX_THREAD_GET_CURRENT(thread_ptr)
+
+ /* Determine if this is a legal request. */
+
+ /* Is there a current thread? */
+ if (thread_ptr == TX_NULL)
+ {
+
+ /* Illegal caller of this service. */
+ return(TX_CALLER_ERROR);
+ }
+
+ /* Is the caller an ISR or Initialization? */
+ if (TX_THREAD_GET_SYSTEM_STATE() != 0)
+ {
+
+ /* Illegal caller of this service. */
+ return(TX_CALLER_ERROR);
+ }
+
+#ifndef TX_TIMER_PROCESS_IN_ISR
+
+ /* Check for invalid caller of this function. First check for a calling thread. */
+ if (thread_ptr == &_tx_timer_thread)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+#endif
+
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Get module manager protection mutex. */
+ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if the module instance is valid. */
+ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Determine if the module instance is in the loaded state. */
+ if (module_instance -> txm_module_instance_state != TXM_MODULE_STARTED)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return error if the module is not ready. */
+ return(TX_START_ERROR);
+ }
+
+ /* Set the module state to indicate the module is stopping. */
+ module_instance -> txm_module_instance_state = TXM_MODULE_STOPPING;
+
+ /* This thread was previously used as the start thread. So first, make sure it is terminated and deleted before doing anything else. */
+ _tx_thread_terminate(&(module_instance -> txm_module_instance_start_stop_thread));
+ _tx_thread_delete(&(module_instance -> txm_module_instance_start_stop_thread));
+
+ /* Determine if there is a module stop function. */
+ if (module_instance -> txm_module_instance_stop_thread_entry)
+ {
+
+ /* Yes, there is a stop function. Build a thread for executing the module stop function. */
+
+ /* Create the module stop thread. */
+ _txm_module_manager_thread_create(&(module_instance -> txm_module_instance_start_stop_thread),
+ "Module Stop Thread",
+ module_instance -> txm_module_instance_shell_entry_function,
+ module_instance -> txm_module_instance_stop_thread_entry,
+ module_instance -> txm_module_instance_application_module_id,
+ module_instance -> txm_module_instance_start_stop_stack_start_address,
+ module_instance -> txm_module_instance_start_stop_stack_size,
+ (UINT) module_instance -> txm_module_instance_start_stop_priority,
+ (UINT) module_instance -> txm_module_instance_start_stop_priority,
+ TXM_MODULE_TIME_SLICE,
+ TX_AUTO_START,
+ sizeof(TX_THREAD),
+ module_instance);
+
+ /* Wait for the stop thread to complete. */
+ i = 0;
+ while ((i < TXM_MODULE_TIMEOUT) && (module_instance -> txm_module_instance_start_stop_thread.tx_thread_state != TX_COMPLETED))
+ {
+
+ /* Sleep to let the module stop thread run. */
+ _tx_thread_sleep(1);
+
+ /* Increment the counter. */
+ i++;
+ }
+
+ /* At this point, we need to terminate and delete the stop thread. */
+ _tx_thread_terminate(&(module_instance -> txm_module_instance_start_stop_thread));
+ _tx_thread_delete(&(module_instance -> txm_module_instance_start_stop_thread));
+ }
+
+ /* Delete the module's callback thread and queue for the callback thread. */
+ _tx_thread_terminate(&(module_instance -> txm_module_instance_callback_request_thread));
+ _tx_thread_delete(&(module_instance -> txm_module_instance_callback_request_thread));
+ _tx_queue_delete(&(module_instance -> txm_module_instance_callback_request_queue));
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Temporarily disable preemption. This will keep other threads from creating and deleting threads. */
+ _tx_thread_preempt_disable++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Determine if any external component stop functions have been registered and
+ if so, call them to cleanup any module objects in that component. */
+
+#ifdef TXM_MODULE_ENABLE_FILEX
+
+ /* Call the FileX stop function. */
+ _txm_module_manager_filex_stop(module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETX
+
+ /* Call the NetX stop function. */
+ _txm_module_manager_netx_stop(module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_NETXDUO
+
+ /* Call the NetX Duo stop function. */
+ _txm_module_manager_netxduo_stop(module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_GUIX
+
+ /* Call the GUIX stop function. */
+ _txm_module_manager_guix_stop(module_instance);
+#endif
+
+#ifdef TXM_MODULE_ENABLE_USBX
+
+ /* Call the USBX stop function. */
+ _txm_module_manager_usbx_stop(module_instance);
+#endif
+
+ /* Loop to delete any and all threads created by the module. */
+ i = _tx_thread_created_count;
+ thread_ptr = _tx_thread_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next thread pointer. */
+ next_thread_ptr = thread_ptr -> tx_thread_created_next;
+
+ /* Determine if the thread control block is inside the module. */
+ if ( (((CHAR *) thread_ptr) >= ((CHAR *) module_instance -> txm_module_instance_data_start)) &&
+ (((CHAR *) thread_ptr) < ((CHAR *) module_instance -> txm_module_instance_data_end)))
+ {
+
+ /* Terminate and delete this thread, since it is part of this module. */
+ _tx_thread_terminate(thread_ptr);
+ _tx_thread_delete(thread_ptr);
+ }
+
+ /* Is this thread part of the module? */
+ else if (thread_ptr -> tx_thread_module_instance_ptr == module_instance)
+ {
+
+ /* Terminate and delete this thread, since it is part of this module. */
+ _tx_thread_terminate(thread_ptr);
+ _tx_thread_delete(thread_ptr);
+ }
+
+ /* Move to next thread. */
+ thread_ptr = next_thread_ptr;
+ }
+
+ /* Loop to delete any and all timers created by the module. */
+ i = _tx_timer_created_count;
+ timer_ptr = _tx_timer_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next timer pointer. */
+ next_timer_ptr = timer_ptr -> tx_timer_created_next;
+
+ /* Check if this module created this timer. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) timer_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this timer, since it is part of this module. */
+ _tx_timer_delete(timer_ptr);
+ }
+
+ /* Move to next timer. */
+ timer_ptr = next_timer_ptr;
+ }
+
+ /* Loop to delete any and all queues created by the module. */
+ i = _tx_queue_created_count;
+ queue_ptr = _tx_queue_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next queue pointer. */
+ next_queue_ptr = queue_ptr -> tx_queue_created_next;
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+
+ /* Determine if the queue callback function is associated with this module. */
+ if ((queue_ptr -> tx_queue_module_instance == module_instance) &&
+ (queue_ptr -> tx_queue_send_notify == _txm_module_manager_queue_notify_trampoline))
+ {
+
+ /* Clear the callback notification for this queue since it is no longer valid. */
+ queue_ptr -> tx_queue_send_notify = TX_NULL;
+ }
+#endif
+
+ /* Check if this module created this queue. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) queue_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this queue, since it is part of this module. */
+ _tx_queue_delete(queue_ptr);
+ }
+
+ /* Move to next queue. */
+ queue_ptr = next_queue_ptr;
+ }
+
+ /* Loop to delete any and all event flag groups created by the module. */
+ i = _tx_event_flags_created_count;
+ events_ptr = _tx_event_flags_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next event flags group pointer. */
+ next_events_ptr = events_ptr -> tx_event_flags_group_created_next;
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+
+ /* Determine if the event flags callback function is associated with this module. */
+ if ((events_ptr -> tx_event_flags_group_module_instance == module_instance) &&
+ (events_ptr -> tx_event_flags_group_set_notify == _txm_module_manager_event_flags_notify_trampoline))
+ {
+
+ /* Clear the callback notification for this event flag group since it is no longer valid. */
+ events_ptr -> tx_event_flags_group_set_notify = TX_NULL;
+ }
+#endif
+
+ /* Check if this module created this event flags. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) events_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this event flags group, since it is part of this module. */
+ _tx_event_flags_delete(events_ptr);
+ }
+
+ /* Move to next event flags group. */
+ events_ptr = next_events_ptr;
+ }
+
+ /* Loop to delete any and all semaphores created by the module. */
+ i = _tx_semaphore_created_count;
+ semaphore_ptr = _tx_semaphore_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next semaphore pointer. */
+ next_semaphore_ptr = semaphore_ptr -> tx_semaphore_created_next;
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+
+ /* Determine if the semaphore callback function is associated with this module. */
+ if ((semaphore_ptr -> tx_semaphore_module_instance == module_instance) &&
+ (semaphore_ptr -> tx_semaphore_put_notify == _txm_module_manager_semaphore_notify_trampoline))
+ {
+
+ /* Clear the callback notification for this semaphore since it is no longer valid. */
+ semaphore_ptr -> tx_semaphore_put_notify = TX_NULL;
+ }
+#endif
+
+ /* Check if this module created this semaphore. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) semaphore_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this semaphore, since it is part of this module. */
+ _tx_semaphore_delete(semaphore_ptr);
+ }
+
+ /* Move to next semaphore. */
+ semaphore_ptr = next_semaphore_ptr;
+ }
+
+ /* Loop to delete any and all mutexes created by the module. */
+ i = _tx_mutex_created_count;
+ mutex_ptr = _tx_mutex_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next mutex pointer. */
+ next_mutex_ptr = mutex_ptr -> tx_mutex_created_next;
+
+ /* Check if this module created this mutex. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) mutex_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this mutex, since it is part of this module. */
+ _tx_mutex_delete(mutex_ptr);
+ }
+
+ /* Move to next mutex. */
+ mutex_ptr = next_mutex_ptr;
+ }
+
+ /* Loop to delete any and all block pools created by the module. */
+ i = _tx_block_pool_created_count;
+ block_pool_ptr = _tx_block_pool_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next block pool pointer. */
+ next_block_pool_ptr = block_pool_ptr -> tx_block_pool_created_next;
+
+ /* Check if this module created this block pool. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) block_pool_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this block pool, since it is part of this module. */
+ _tx_block_pool_delete(block_pool_ptr);
+ }
+
+ /* Move to next block pool. */
+ block_pool_ptr = next_block_pool_ptr;
+ }
+
+ /* Loop to delete any and all byte pools created by the module. */
+ i = _tx_byte_pool_created_count;
+ byte_pool_ptr = _tx_byte_pool_created_ptr;
+ while (i--)
+ {
+
+ /* Pickup the next byte pool pointer. */
+ next_byte_pool_ptr = byte_pool_ptr -> tx_byte_pool_created_next;
+
+ /* Check if this module created this byte pool. */
+ created_by_module = _txm_module_manager_created_object_check(module_instance, (VOID *) byte_pool_ptr);
+ if (created_by_module == TX_TRUE)
+ {
+
+ /* Delete this byte pool, since it is part of this module. */
+ _tx_byte_pool_delete(byte_pool_ptr);
+ }
+
+ /* Move to next byte pool. */
+ byte_pool_ptr = next_byte_pool_ptr;
+ }
+
+#ifdef TX_ENABLE_EVENT_TRACE
+ /* Has trace been enabled? */
+ if (_tx_trace_buffer_current_ptr != TX_NULL)
+ {
+
+ /* Is the trace buffer located inside the module? */
+ if ((ULONG) _tx_trace_header_ptr -> tx_trace_header_buffer_start_pointer >= (ULONG) module_instance -> txm_module_instance_data_start &&
+ (ULONG) _tx_trace_header_ptr -> tx_trace_header_buffer_start_pointer < (ULONG) module_instance -> txm_module_instance_data_end)
+ {
+ _tx_trace_disable();
+ }
+ }
+#endif
+
+ /* Delete the allocated objects for this module. */
+ while (module_instance -> txm_module_instance_object_list_count--)
+ {
+
+ /* Pickup the current object pointer. */
+ object_ptr = module_instance -> txm_module_instance_object_list_head;
+
+ /* Move the head pointer forward. */
+ module_instance -> txm_module_instance_object_list_head = object_ptr -> txm_module_allocated_object_next;
+
+ /* Release the object. */
+ _tx_byte_release((VOID *) object_ptr);
+ }
+
+ /* Set the allocated list head pointer to NULL. */
+ module_instance -> txm_module_instance_object_list_head = TX_NULL;
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Enable preemption again. */
+ _tx_thread_preempt_disable--;
+
+ /* Set the module state to indicate the module is stopped. */
+ module_instance -> txm_module_instance_state = TXM_MODULE_STOPPED;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Check for preemption. */
+ _tx_thread_system_preempt_check();
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_thread_create.c b/common_modules/module_manager/src/txm_module_manager_thread_create.c
new file mode 100644
index 00000000..52dae4a5
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_thread_create.c
@@ -0,0 +1,585 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_trace.h"
+#include "tx_initialize.h"
+#include "tx_thread.h"
+#include "tx_timer.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_thread_create PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates a thread and places it on the list of created */
+/* threads. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread control block pointer */
+/* name Pointer to thread name string */
+/* shell_function Shell function of the thread */
+/* entry_function Entry function of the thread */
+/* entry_input 32-bit input value to thread */
+/* stack_start Pointer to start of stack */
+/* stack_size Stack size in bytes */
+/* priority Priority of thread */
+/* (default 0-31) */
+/* preempt_threshold Preemption threshold */
+/* time_slice Thread time-slice value */
+/* auto_start Automatic start selection */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_thread_stack_build Build initial thread stack */
+/* _tx_thread_system_resume Resume automatic start thread */
+/* _tx_thread_system_ni_resume Noninterruptable resume thread*/
+/* _tx_thread_system_preempt_check Check for preemption */
+/* */
+/* CALLED BY */
+/* */
+/* _txm_module_manager_start Initiate module's start thread*/
+/* _txm_module_manager_stop Initiate module's stop thread */
+/* _txm_module_manager_kernel_dispatch Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_thread_create(TX_THREAD *thread_ptr, CHAR *name, VOID (*shell_function)(TX_THREAD *, TXM_MODULE_INSTANCE *),
+ VOID (*entry_function)(ULONG), ULONG entry_input,
+ VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
+ ULONG time_slice, UINT auto_start, UINT thread_control_block_size, TXM_MODULE_INSTANCE *module_instance)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TX_THREAD *next_thread;
+TX_THREAD *previous_thread;
+#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
+TX_THREAD *saved_thread_ptr;
+UINT saved_threshold = 0;
+#endif
+#ifdef TX_ENABLE_STACK_CHECKING
+ULONG new_stack_start;
+#endif
+TXM_MODULE_THREAD_ENTRY_INFO *thread_entry_info;
+VOID *stack_end;
+ULONG i;
+#ifndef TX_TIMER_PROCESS_IN_ISR
+TX_THREAD *current_thread;
+#endif
+#if TXM_MODULE_MEMORY_PROTECTION
+ULONG status;
+#endif
+
+ /* First, check for an invalid thread pointer. */
+ if (thread_ptr == TX_NULL)
+ {
+
+ /* Thread pointer is invalid, return appropriate error code. */
+ return(TX_THREAD_ERROR);
+ }
+
+ /* Now check for invalid thread control block size. */
+ else if (thread_control_block_size != (sizeof(TX_THREAD)))
+ {
+
+ /* Thread pointer is invalid, return appropriate error code. */
+ return(TX_THREAD_ERROR);
+ }
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Increment the preempt disable flag. */
+ _tx_thread_preempt_disable++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Next see if it is already in the created list. */
+ next_thread = _tx_thread_created_ptr;
+ stack_end = (VOID *) (((UCHAR *) ((VOID *) stack_start)) + (stack_size - 1));
+ for (i = 0; i < _tx_thread_created_count; i++)
+ {
+
+ /* Determine if this thread matches the thread in the list. */
+ if (thread_ptr == next_thread)
+ {
+
+ break;
+ }
+
+ /* Check the stack pointer to see if it overlaps with this thread's stack. */
+
+ /*lint -e{946} suppress pointer comparison, since this is necessary. */
+ if (((UCHAR *) ((VOID *) stack_start)) >= ((UCHAR *) ((VOID *) next_thread -> tx_thread_stack_start)))
+ {
+
+ /*lint -e{946} suppress pointer comparison, since this is necessary. */
+ if (((UCHAR *) ((VOID *) stack_start)) < ((UCHAR *) ((VOID *) next_thread -> tx_thread_stack_end)))
+ {
+
+ /* This stack overlaps with an existing thread, clear the stack pointer to
+ force a stack error below. */
+ stack_start = TX_NULL;
+ break;
+ }
+ }
+
+ /* Check the end of the stack to see if it is inside this thread's stack area as well. */
+
+ /*lint -e{946} suppress pointer comparison, since this is necessary. */
+ if (((UCHAR *) ((VOID *) stack_end)) >= ((UCHAR *) ((VOID *) next_thread -> tx_thread_stack_start)))
+ {
+
+ /*lint -e{946} suppress pointer comparison, since this is necessary. */
+ if (((UCHAR *) ((VOID *) stack_end)) < ((UCHAR *) ((VOID *) next_thread -> tx_thread_stack_end)))
+ {
+
+ /* This stack overlaps with an existing thread, clear the stack pointer to
+ force a stack error below. */
+ stack_start = TX_NULL;
+ break;
+ }
+ }
+
+ /* Move to the next thread. */
+ next_thread = next_thread -> tx_thread_created_next;
+ }
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Decrement the preempt disable flag. */
+ _tx_thread_preempt_disable--;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Check for preemption. */
+ _tx_thread_system_preempt_check();
+
+ /* At this point, check to see if there is a duplicate thread. */
+ if (thread_ptr == next_thread)
+ {
+
+ /* Thread is already created, return appropriate error code. */
+ return(TX_THREAD_ERROR);
+ }
+
+ /* Check for invalid starting address of stack. */
+ if (stack_start == TX_NULL)
+ {
+
+ /* Invalid stack or entry point, return appropriate error code. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Check for invalid thread entry point. */
+ if (entry_function == TX_NULL)
+ {
+
+ /* Invalid stack or entry point, return appropriate error code. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Check the stack size. */
+ if (stack_size < TX_MINIMUM_STACK)
+ {
+
+ /* Stack is not big enough, return appropriate error code. */
+ return(TX_SIZE_ERROR);
+ }
+
+ /* Check the priority specified. */
+ if (priority >= TX_MAX_PRIORITIES)
+ {
+
+ /* Invalid priority selected, return appropriate error code. */
+ return(TX_PRIORITY_ERROR);
+ }
+
+ /* Check preemption threshold. */
+ if (preempt_threshold > priority)
+ {
+
+ /* Invalid preempt threshold, return appropriate error code. */
+ return(TX_THRESH_ERROR);
+ }
+
+ /* Check the start selection. */
+ if (auto_start > TX_AUTO_START)
+ {
+
+ /* Invalid auto start selection, return appropriate error code. */
+ return(TX_START_ERROR);
+ }
+
+#ifndef TX_TIMER_PROCESS_IN_ISR
+
+ /* Pickup thread pointer. */
+ TX_THREAD_GET_CURRENT(current_thread)
+
+ /* Check for invalid caller of this function. First check for a calling thread. */
+ if (current_thread == &_tx_timer_thread)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+#endif
+
+ /* Check for interrupt call. */
+ if (TX_THREAD_GET_SYSTEM_STATE() != 0)
+ {
+
+ /* Now, make sure the call is from an interrupt and not initialization. */
+ if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+ }
+
+#ifndef TX_DISABLE_STACK_FILLING
+
+ /* Set the thread stack to a pattern prior to creating the initial
+ stack frame. This pattern is used by the stack checking routines
+ to see how much has been used. */
+ TX_MEMSET(stack_start, ((UCHAR) TX_STACK_FILL), stack_size);
+#endif
+
+#ifdef TX_ENABLE_STACK_CHECKING
+
+ /* Ensure that there are two ULONG of 0xEF patterns at the top and
+ bottom of the thread's stack. This will be used to check for stack
+ overflow conditions during run-time. */
+ stack_size = ((stack_size/sizeof(ULONG)) * sizeof(ULONG)) - sizeof(ULONG);
+
+ /* Ensure the starting stack address is evenly aligned. */
+ new_stack_start = ((((ULONG) stack_start) + (sizeof(ULONG) - 1) ) & (~(sizeof(ULONG) - 1)));
+
+ /* Determine if the starting stack address is different. */
+ if (new_stack_start != ((ULONG) stack_start))
+ {
+
+ /* Yes, subtract another ULONG from the size to avoid going past the stack area. */
+ stack_size = stack_size - sizeof(ULONG);
+ }
+
+ /* Update the starting stack pointer. */
+ stack_start = (VOID *) new_stack_start;
+#endif
+
+ /* Allocate the thread entry information at the top of thread's stack - Leaving one
+ ULONG worth of 0xEF pattern between the actual stack and the entry info structure. */
+ stack_size = stack_size - (sizeof(TXM_MODULE_THREAD_ENTRY_INFO) + (3*sizeof(ULONG)));
+
+ /* Prepare the thread control block prior to placing it on the created
+ list. */
+
+ /* Initialize thread control block to all zeros. */
+ TX_MEMSET(thread_ptr, 0, sizeof(TX_THREAD));
+
+#if TXM_MODULE_MEMORY_PROTECTION
+ /* If this is a memory protected module, allocate a kernel stack. */
+ if((module_instance -> txm_module_instance_property_flags) & TXM_MODULE_MEMORY_PROTECTION)
+ {
+ /* Allocate kernel stack space. */
+ status = _txm_module_manager_object_allocate((VOID **) &(thread_ptr -> tx_thread_module_kernel_stack_start), TXM_MODULE_KERNEL_STACK_SIZE, module_instance);
+ if(status)
+ {
+ return(status);
+ }
+
+#ifndef TX_DISABLE_STACK_FILLING
+ /* Set the thread stack to a pattern prior to creating the initial
+ stack frame. This pattern is used by the stack checking routines
+ to see how much has been used. */
+ TX_MEMSET(thread_ptr -> tx_thread_module_kernel_stack_start, ((UCHAR) TX_STACK_FILL), TXM_MODULE_KERNEL_STACK_SIZE);
+#endif
+
+ /* Align kernel stack pointer. */
+ thread_ptr -> tx_thread_module_kernel_stack_end = (VOID *) (((ALIGN_TYPE)(thread_ptr -> tx_thread_module_kernel_stack_start) + TXM_MODULE_KERNEL_STACK_SIZE) & ~0x07);
+
+ /* Set kernel stack size. */
+ thread_ptr -> tx_thread_module_kernel_stack_size = TXM_MODULE_KERNEL_STACK_SIZE;
+ }
+
+ /* Place the stack parameters into the thread's control block. */
+ thread_ptr -> tx_thread_module_stack_start = stack_start;
+ thread_ptr -> tx_thread_module_stack_size = stack_size;
+#endif
+
+ /* Place the supplied parameters into the thread's control block. */
+ thread_ptr -> tx_thread_name = name;
+ thread_ptr -> tx_thread_entry = entry_function;
+ thread_ptr -> tx_thread_entry_parameter = entry_input;
+ thread_ptr -> tx_thread_stack_start = stack_start;
+ thread_ptr -> tx_thread_stack_size = stack_size;
+ thread_ptr -> tx_thread_stack_end = (VOID *) (((UCHAR *) stack_start) + (stack_size-1));
+#if TXM_MODULE_MEMORY_PROTECTION
+ thread_ptr -> tx_thread_module_stack_end = thread_ptr -> tx_thread_stack_end;
+#endif
+ thread_ptr -> tx_thread_priority = priority;
+ thread_ptr -> tx_thread_user_priority = priority;
+ thread_ptr -> tx_thread_time_slice = time_slice;
+ thread_ptr -> tx_thread_new_time_slice = time_slice;
+ thread_ptr -> tx_thread_inherit_priority = TX_MAX_PRIORITIES;
+
+#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
+
+ /* Preemption-threshold is enabled, setup accordingly. */
+ thread_ptr -> tx_thread_preempt_threshold = preempt_threshold;
+ thread_ptr -> tx_thread_user_preempt_threshold = preempt_threshold;
+#else
+
+ /* Preemption-threshold is disabled, determine if preemption-threshold was required. */
+ if (priority != preempt_threshold)
+ {
+
+ /* Preemption-threshold specified. Since specific preemption-threshold is not supported,
+ disable all preemption. */
+ thread_ptr -> tx_thread_preempt_threshold = 0;
+ thread_ptr -> tx_thread_user_preempt_threshold = 0;
+ }
+ else
+ {
+
+ /* Preemption-threshold is not specified, just setup with the priority. */
+ thread_ptr -> tx_thread_preempt_threshold = priority;
+ thread_ptr -> tx_thread_user_preempt_threshold = priority;
+ }
+#endif
+
+ /* Now fill in the values that are required for thread initialization. */
+ thread_ptr -> tx_thread_state = TX_SUSPENDED;
+
+ /* Setup the necessary fields in the thread timer block. */
+ TX_THREAD_CREATE_TIMEOUT_SETUP(thread_ptr)
+
+ /* Setup pointer to the thread entry information structure, which will live at the top of each
+ module thread's stack. This will allow the module thread entry function to avoid direct
+ access to the actual thread control block. */
+ thread_entry_info = (TXM_MODULE_THREAD_ENTRY_INFO *) (((UCHAR *) thread_ptr -> tx_thread_stack_end) + (2*sizeof(ULONG)) + 1);
+ thread_entry_info = (TXM_MODULE_THREAD_ENTRY_INFO *) (((ALIGN_TYPE)(thread_entry_info)) & (~0x3));
+
+ /* Build the thread entry information structure. */
+ thread_entry_info -> txm_module_thread_entry_info_thread = thread_ptr;
+ thread_entry_info -> txm_module_thread_entry_info_module = module_instance;
+ thread_entry_info -> txm_module_thread_entry_info_data_base_address = module_instance -> txm_module_instance_module_data_base_address;
+ thread_entry_info -> txm_module_thread_entry_info_code_base_address = module_instance -> txm_module_instance_code_start;
+ thread_entry_info -> txm_module_thread_entry_info_entry = thread_ptr -> tx_thread_entry;
+ thread_entry_info -> txm_module_thread_entry_info_parameter = thread_ptr -> tx_thread_entry_parameter;
+ thread_entry_info -> txm_module_thread_entry_info_callback_request_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+ thread_entry_info -> txm_module_thread_entry_info_callback_request_thread = &(module_instance -> txm_module_instance_callback_request_thread);
+
+ /* Populate thread control block with some stock information from the module. */
+ TXM_MODULE_MANAGER_THREAD_SETUP(thread_ptr, module_instance)
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+ thread_entry_info -> txm_module_thread_entry_info_exit_notify = thread_ptr -> tx_thread_entry_exit_notify;
+#else
+ thread_entry_info -> txm_module_thread_entry_info_exit_notify = TX_NULL;
+#endif
+ if (thread_ptr -> tx_thread_entry == module_instance -> txm_module_instance_start_thread_entry)
+ thread_entry_info -> txm_module_thread_entry_info_start_thread = TX_TRUE;
+ else
+ thread_entry_info -> txm_module_thread_entry_info_start_thread = TX_FALSE;
+
+ /* Place pointers to the thread info and module instance in the thread control block. */
+ thread_ptr -> tx_thread_module_instance_ptr = (VOID *) module_instance;
+ thread_ptr -> tx_thread_module_entry_info_ptr = (VOID *) thread_entry_info;
+
+ /* Place the thread entry information pointer in the thread control block so it can be picked up
+ in the following stack build function. This is supplied to the module's shell entry function
+ to avoid direct access to the actual thread control block. Note that this is overwritten
+ with the actual stack pointer at the end of stack build. */
+ thread_ptr -> tx_thread_stack_ptr = (VOID *) thread_entry_info;
+
+ /* Call the target specific stack frame building routine to build the
+ thread's initial stack and to setup the actual stack pointer in the
+ control block. */
+ _txm_module_manager_thread_stack_build(thread_ptr, shell_function);
+
+#ifdef TX_ENABLE_STACK_CHECKING
+
+ /* Setup the highest usage stack pointer. */
+ thread_ptr -> tx_thread_stack_highest_ptr = thread_ptr -> tx_thread_stack_ptr;
+#endif
+
+ /* Prepare to make this thread a member of the created thread list. */
+ TX_DISABLE
+
+ /* Load the thread ID field in the thread control block. */
+ thread_ptr -> tx_thread_id = TX_THREAD_ID;
+
+ /* Place the thread on the list of created threads. First,
+ check for an empty list. */
+ if (_tx_thread_created_count++ == 0)
+ {
+
+ /* The created thread list is empty. Add thread to empty list. */
+ _tx_thread_created_ptr = thread_ptr;
+ thread_ptr -> tx_thread_created_next = thread_ptr;
+ thread_ptr -> tx_thread_created_previous = thread_ptr;
+ }
+ else
+ {
+
+ /* This list is not NULL, add to the end of the list. */
+ next_thread = _tx_thread_created_ptr;
+ previous_thread = next_thread -> tx_thread_created_previous;
+
+ /* Place the new thread in the list. */
+ next_thread -> tx_thread_created_previous = thread_ptr;
+ previous_thread -> tx_thread_created_next = thread_ptr;
+
+ /* Setup this thread's created links. */
+ thread_ptr -> tx_thread_created_previous = previous_thread;
+ thread_ptr -> tx_thread_created_next = next_thread;
+ }
+
+ /* If trace is enabled, register this object. */
+ TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_THREAD, thread_ptr, name, stack_start, stack_size)
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_CREATE, thread_ptr, priority, stack_start, stack_size, TX_TRACE_THREAD_EVENTS)
+
+ /* Register thread in the thread array structure. */
+ TX_EL_THREAD_REGISTER(thread_ptr)
+
+ /* Log this kernel call. */
+ TX_EL_THREAD_CREATE_INSERT
+
+ /* Determine if an automatic start was requested. If so, call the resume
+ thread function and then check for a preemption condition. */
+ if (auto_start == TX_AUTO_START)
+ {
+
+#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
+
+ /* Determine if the create call is being called from initialization. */
+ if (TX_THREAD_GET_SYSTEM_STATE() >= TX_INITIALIZE_IN_PROGRESS)
+ {
+
+ /* Yes, this create call was made from initialization. */
+
+ /* Pickup the current thread execute pointer, which corresponds to the
+ highest priority thread ready to execute. Interrupt lockout is
+ not required, since interrupts are assumed to be disabled during
+ initialization. */
+ saved_thread_ptr = _tx_thread_execute_ptr;
+
+ /* Determine if there is thread ready for execution. */
+ if (saved_thread_ptr != TX_NULL)
+ {
+
+ /* Yes, a thread is ready for execution when initialization completes. */
+
+ /* Save the current preemption-threshold. */
+ saved_threshold = saved_thread_ptr -> tx_thread_preempt_threshold;
+
+ /* For initialization, temporarily set the preemption-threshold to the
+ priority level to make sure the highest-priority thread runs once
+ initialization is complete. */
+ saved_thread_ptr -> tx_thread_preempt_threshold = saved_thread_ptr -> tx_thread_priority;
+ }
+ }
+ else
+ {
+
+ /* Simply set the saved thread pointer to NULL. */
+ saved_thread_ptr = TX_NULL;
+ }
+#endif
+
+#ifdef TX_NOT_INTERRUPTABLE
+
+ /* Perform any additional activities for tool or user purpose. */
+ TX_THREAD_CREATE_EXTENSION(thread_ptr)
+
+ /* Resume the thread! */
+ _tx_thread_system_ni_resume(thread_ptr);
+
+ /* Restore previous interrupt posture. */
+ TX_RESTORE
+#else
+
+ /* Temporarily disable preemption. */
+ _tx_thread_preempt_disable++;
+
+ /* Restore previous interrupt posture. */
+ TX_RESTORE
+
+ /* Perform any additional activities for tool or user purpose. */
+ TX_THREAD_CREATE_EXTENSION(thread_ptr)
+
+ /* Call the resume thread function to make this thread ready. */
+ _tx_thread_system_resume(thread_ptr);
+#endif
+
+#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
+
+ /* Determine if the thread's preemption-threshold needs to be restored. */
+ if (saved_thread_ptr != TX_NULL)
+ {
+
+ /* Yes, restore the previous highest-priority thread's preemption-threshold. This
+ can only happen if this routine is called from initialization. */
+ saved_thread_ptr -> tx_thread_preempt_threshold = saved_threshold;
+ }
+#endif
+
+ /* Interrupts are already restored, simply return success. */
+ return(TX_SUCCESS);
+ }
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_thread_notify_trampoline.c b/common_modules/module_manager/src/txm_module_manager_thread_notify_trampoline.c
new file mode 100644
index 00000000..569d03f5
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_thread_notify_trampoline.c
@@ -0,0 +1,153 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_queue.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+#ifndef TX_DISABLE_NOTIFY_CALLBACKS
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_thread_notify_trampoline PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the thread entry/exit notification call */
+/* from ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread pointer */
+/* type Entry or exit type */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_callback_request Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_thread_notify_trampoline(TX_THREAD *thread_ptr, UINT type)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+TX_QUEUE *module_callback_queue;
+TXM_MODULE_THREAD_ENTRY_INFO *thread_info;
+
+
+ /* We now know the callback is for a module. */
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Determine if the thread is valid. */
+ if ((thread_ptr) && (thread_ptr -> tx_thread_id == TX_THREAD_ID))
+ {
+
+ /* Pickup the module instance pointer. */
+ module_instance = (TXM_MODULE_INSTANCE *) thread_ptr -> tx_thread_module_instance_ptr;
+
+ /* Pickup the module's thread pointer. */
+ thread_info = (TXM_MODULE_THREAD_ENTRY_INFO *) thread_ptr -> tx_thread_module_entry_info_ptr;
+
+ /* Determine if this module is still valid. */
+ if ((module_instance) && (module_instance -> txm_module_instance_id == TXM_MODULE_ID) &&
+ (module_instance -> txm_module_instance_state == TXM_MODULE_STARTED))
+ {
+
+ /* Yes, the module is still valid. */
+
+ /* Pickup the module's callback message queue. */
+ module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+
+ /* Build the queue notification message. */
+ callback_message.txm_module_callback_message_type = TXM_THREAD_ENTRY_EXIT_CALLBACK;
+ callback_message.txm_module_callback_message_activation_count = 1;
+ callback_message.txm_module_callback_message_application_function = (VOID (*)(VOID)) thread_info -> txm_module_thread_entry_info_exit_notify;
+ callback_message.txm_module_callback_message_param_1 = (ALIGN_TYPE) thread_ptr;
+ callback_message.txm_module_callback_message_param_2 = (ALIGN_TYPE) type;
+ callback_message.txm_module_callback_message_param_3 = 0;
+ callback_message.txm_module_callback_message_param_4 = 0;
+ callback_message.txm_module_callback_message_param_5 = 0;
+ callback_message.txm_module_callback_message_param_6 = 0;
+ callback_message.txm_module_callback_message_param_7 = 0;
+ callback_message.txm_module_callback_message_param_8 = 0;
+ callback_message.txm_module_callback_message_reserved1 = 0;
+ callback_message.txm_module_callback_message_reserved2 = 0;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Call the general processing that will place the callback on the
+ module's callback request queue. */
+ _txm_module_manager_callback_request(module_callback_queue, &callback_message);
+ }
+ else
+ {
+
+ /* Module no longer valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+ }
+ else
+ {
+
+ /* Thread pointer is not valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+#endif
+
diff --git a/common_modules/module_manager/src/txm_module_manager_thread_reset.c b/common_modules/module_manager/src/txm_module_manager_thread_reset.c
new file mode 100644
index 00000000..c75be7b6
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_thread_reset.c
@@ -0,0 +1,180 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_trace.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_thread_reset PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function prepares the thread to run again from the entry */
+/* point specified during thread creation. The application must */
+/* call tx_thread_resume after this call completes for the thread */
+/* to actually run. */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Pointer to thread to reset */
+/* */
+/* OUTPUT */
+/* */
+/* status Service return status */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_thread_stack_build Build initial thread */
+/* stack */
+/* */
+/* CALLED BY */
+/* */
+/* _txm_module_manager_kernel_dispatch Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_thread_reset(TX_THREAD *thread_ptr)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TX_THREAD *current_thread;
+UINT status;
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_THREAD_ENTRY_INFO *thread_entry_info;
+
+ /* Default a successful completion status. */
+ status = TX_SUCCESS;
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Pickup thread pointer. */
+ TX_THREAD_GET_CURRENT(current_thread)
+
+ /* Check for a call from the current thread, which is not allowed! */
+ if (current_thread == thread_ptr)
+ {
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Thread not completed or terminated - return an error! */
+ status = TX_NOT_DONE;
+ }
+ else
+ {
+
+ /* Check for proper status of this thread to reset. */
+ if (thread_ptr -> tx_thread_state != TX_COMPLETED)
+ {
+
+ /* Now check for terminated state. */
+ if (thread_ptr -> tx_thread_state != TX_TERMINATED)
+ {
+
+ /* Thread not completed or terminated - return an error! */
+ status = TX_NOT_DONE;
+ }
+ }
+ }
+
+ /* Is the request valid? */
+ if (status == TX_SUCCESS)
+ {
+
+ /* Modify the thread status to prevent additional reset calls. */
+ thread_ptr -> tx_thread_state = TX_NOT_DONE;
+
+ /* Get the module instance. */
+ module_instance = thread_ptr -> tx_thread_module_instance_ptr;
+
+ /* Execute Port-Specific completion processing. If needed, it is typically defined in txm_module_port.h. */
+ TXM_MODULE_MANAGER_THREAD_RESET_PORT_COMPLETION(thread_ptr, module_instance)
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+#ifndef TX_DISABLE_STACK_FILLING
+
+ /* Set the thread stack to a pattern prior to creating the initial
+ stack frame. This pattern is used by the stack checking routines
+ to see how much has been used. */
+ TX_MEMSET(thread_ptr -> tx_thread_stack_start, ((UCHAR) TX_STACK_FILL), thread_ptr -> tx_thread_stack_size);
+#endif
+
+ /* Setup pointer to the thread entry information structure, which will live at the top of each
+ module thread's stack. This will allow the module thread entry function to avoid direct
+ access to the actual thread control block. */
+ thread_entry_info = (TXM_MODULE_THREAD_ENTRY_INFO *) (((UCHAR *) thread_ptr -> tx_thread_stack_end) + (2*sizeof(ULONG)) + 1);
+ thread_entry_info = (TXM_MODULE_THREAD_ENTRY_INFO *) (((ALIGN_TYPE)(thread_entry_info)) & (~0x3));
+
+ /* Place the thread entry information pointer in the thread control block so it can be picked up
+ in the following stack build function. This is supplied to the module's shell entry function
+ to avoid direct access to the actual thread control block. Note that this is overwritten
+ with the actual stack pointer at the end of stack build. */
+ thread_ptr -> tx_thread_stack_ptr = (VOID *) thread_entry_info;
+
+ /* Call the target specific stack frame building routine to build the
+ thread's initial stack and to setup the actual stack pointer in the
+ control block. */
+ _txm_module_manager_thread_stack_build(thread_ptr, module_instance -> txm_module_instance_shell_entry_function);
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Finally, move into a suspended state to allow for the thread to be resumed. */
+ thread_ptr -> tx_thread_state = TX_SUSPENDED;
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_RESET, thread_ptr, thread_ptr -> tx_thread_state, 0, 0, TX_TRACE_THREAD_EVENTS)
+
+ /* Log this kernel call. */
+ TX_EL_THREAD_RESET_INSERT
+
+ /* Log the thread status change. */
+ TX_EL_THREAD_STATUS_CHANGE_INSERT(thread_ptr, TX_SUSPENDED)
+ }
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Return completion status to caller. */
+ return(status);
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_timer_notify_trampoline.c b/common_modules/module_manager/src/txm_module_manager_timer_notify_trampoline.c
new file mode 100644
index 00000000..2a11f146
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_timer_notify_trampoline.c
@@ -0,0 +1,141 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+
+#include "tx_api.h"
+#include "tx_thread.h"
+#include "tx_timer.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_timer_notify_trampoline PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function processes the timer expirations from ThreadX. */
+/* */
+/* INPUT */
+/* */
+/* id Timer ID */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _txm_module_manager_callback_request Send module callback request */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+VOID _txm_module_manager_timer_notify_trampoline(ULONG id)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *module_instance;
+TXM_MODULE_CALLBACK_MESSAGE callback_message;
+TX_QUEUE *module_callback_queue;
+TX_TIMER *timer_ptr;
+CHAR *internal_ptr;
+
+
+ /* We now know the callback is for a module. */
+
+ /* Disable interrupts. */
+ TX_DISABLE
+
+ /* Our expired timer pointer points to the internal timer,
+ * we need to get to the full timer pointer. */
+ /* Pickup the current internal timer pointer. */
+ internal_ptr = (CHAR *) _tx_timer_expired_timer_ptr;
+
+ /* Get the timer pointer from the internal pointer. */
+ TX_USER_TIMER_POINTER_GET((TX_TIMER_INTERNAL *) internal_ptr, timer_ptr);
+
+ /* Pickup the module instance pointer. */
+ module_instance = (TXM_MODULE_INSTANCE *) timer_ptr -> tx_timer_module_instance;
+
+ /* Determine if this module is still valid. */
+ if ((module_instance) && (module_instance -> txm_module_instance_id == TXM_MODULE_ID) &&
+ (module_instance -> txm_module_instance_state == TXM_MODULE_STARTED))
+ {
+
+ /* Yes, the module is still valid. */
+
+ /* Pickup the module's callback message queue. */
+ module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
+
+ /* Build the queue notification message. */
+ callback_message.txm_module_callback_message_type = TXM_TIMER_CALLBACK;
+ callback_message.txm_module_callback_message_activation_count = 1;
+ callback_message.txm_module_callback_message_application_function = (VOID (*)(VOID)) timer_ptr -> tx_timer_module_expiration_function;
+ callback_message.txm_module_callback_message_param_1 = (ULONG) id;
+ callback_message.txm_module_callback_message_param_2 = 0;
+ callback_message.txm_module_callback_message_param_3 = 0;
+ callback_message.txm_module_callback_message_param_4 = 0;
+ callback_message.txm_module_callback_message_param_5 = 0;
+ callback_message.txm_module_callback_message_param_6 = 0;
+ callback_message.txm_module_callback_message_param_7 = 0;
+ callback_message.txm_module_callback_message_param_8 = 0;
+ callback_message.txm_module_callback_message_reserved1 = 0;
+ callback_message.txm_module_callback_message_reserved2 = 0;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Call the general processing that will place the callback on the
+ module's callback request queue. */
+ _txm_module_manager_callback_request(module_callback_queue, &callback_message);
+ }
+ else
+ {
+
+ /* Module no longer valid. */
+
+ /* Error, increment the error counter and return. */
+ _txm_module_manager_callback_error_count++;
+
+ /* Restore interrupts. */
+ TX_RESTORE
+ }
+}
+
diff --git a/common_modules/module_manager/src/txm_module_manager_unload.c b/common_modules/module_manager/src/txm_module_manager_unload.c
new file mode 100644
index 00000000..3689afd4
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_unload.c
@@ -0,0 +1,197 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define TX_SOURCE_CODE
+
+#include "tx_api.h"
+#include "tx_byte_pool.h"
+#include "tx_initialize.h"
+#include "tx_mutex.h"
+#include "tx_thread.h"
+#include "txm_module.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_unload PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function unloads a previously loaded module. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance pointer */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_byte_release Release data area */
+/* _tx_mutex_get Get protection mutex */
+/* _tx_mutex_put Release protection mutex */
+/* */
+/* CALLED BY */
+/* */
+/* Application code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_unload(TXM_MODULE_INSTANCE *module_instance)
+{
+
+TX_INTERRUPT_SAVE_AREA
+
+TXM_MODULE_INSTANCE *next_module, *previous_module;
+CHAR *memory_ptr;
+
+
+ /* Check for interrupt call. */
+ if (TX_THREAD_GET_SYSTEM_STATE() != 0)
+ {
+
+ /* Now, make sure the call is from an interrupt and not initialization. */
+ if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS)
+ {
+
+ /* Invalid caller of this function, return appropriate error code. */
+ return(TX_CALLER_ERROR);
+ }
+ }
+
+ /* Determine if the module manager has not been initialized yet. */
+ if (_txm_module_manager_ready != TX_TRUE)
+ {
+
+ /* Module manager has not been initialized. */
+ return(TX_NOT_AVAILABLE);
+ }
+
+ /* Determine if the module is valid. */
+ if (module_instance == TX_NULL)
+ {
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Get module manager protection mutex. */
+ _tx_mutex_get(&_txm_module_manager_mutex, TX_WAIT_FOREVER);
+
+ /* Determine if the module is already valid. */
+ if (module_instance -> txm_module_instance_id != TXM_MODULE_ID)
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Invalid module pointer. */
+ return(TX_PTR_ERROR);
+ }
+
+ /* Determine if the module instance is in the state. */
+ if ((module_instance -> txm_module_instance_state != TXM_MODULE_LOADED) && (module_instance -> txm_module_instance_state != TXM_MODULE_STOPPED))
+ {
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return error if the module is not ready. */
+ return(TX_NOT_DONE);
+ }
+
+ /* Pickup the module data memory allocation address. */
+ memory_ptr = module_instance -> txm_module_instance_data_allocation_ptr;
+
+ /* Release the module's data memory. */
+ _tx_byte_release(memory_ptr);
+
+ /* Determine if there was memory allocated for the code. */
+ if (module_instance -> txm_module_instance_code_allocation_ptr)
+ {
+
+ /* Yes, release the module's code memory. */
+ memory_ptr = module_instance -> txm_module_instance_code_allocation_ptr;
+
+ /* Release the module's data memory. */
+ _tx_byte_release(memory_ptr);
+ }
+
+ /* Temporarily disable interrupts. */
+ TX_DISABLE
+
+ /* Clear some of the module information. */
+ module_instance -> txm_module_instance_id = 0;
+ module_instance -> txm_module_instance_state = TXM_MODULE_UNLOADED;
+
+ /* Call port-specific unload function. */
+ TXM_MODULE_MANAGER_MODULE_UNLOAD(module_instance);
+
+ /* Remove the module from the linked list of loaded modules. */
+
+ /* See if the module is the only one on the list. */
+ if ((--_txm_module_manger_loaded_count) == 0)
+ {
+
+ /* Only created module, just set the created list to NULL. */
+ _txm_module_manager_loaded_list_ptr = TX_NULL;
+ }
+ else
+ {
+
+ /* Otherwise, not the only created module, link-up the neighbors. */
+ next_module = module_instance -> txm_module_instance_loaded_next;
+ previous_module = module_instance -> txm_module_instance_loaded_previous;
+ next_module -> txm_module_instance_loaded_previous = previous_module;
+ previous_module -> txm_module_instance_loaded_next = next_module;
+
+ /* See if we have to update the created list head pointer. */
+ if (_txm_module_manager_loaded_list_ptr == module_instance)
+ {
+
+ /* Yes, move the head pointer to the next link. */
+ _txm_module_manager_loaded_list_ptr = next_module;
+ }
+ }
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Release the protection mutex. */
+ _tx_mutex_put(&_txm_module_manager_mutex);
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}
diff --git a/common_modules/module_manager/src/txm_module_manager_util.c b/common_modules/module_manager/src/txm_module_manager_util.c
new file mode 100644
index 00000000..e2f5bb44
--- /dev/null
+++ b/common_modules/module_manager/src/txm_module_manager_util.c
@@ -0,0 +1,417 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Component */
+/** */
+/** Module Manager */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define TX_SOURCE_CODE
+
+#include "txm_module.h"
+#include "txm_module_manager_util.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_memory_check PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks if the object is inside a module's object pool */
+/* or, if it's a privileged module, inside the module's data area. */
+/* */
+/* INPUT */
+/* */
+/* module_instance Module instance that the object */
+/* belongs to */
+/* object_ptr Pointer to object to check */
+/* object_size Size of the object to check */
+/* */
+/* OUTPUT */
+/* */
+/* status Whether the object resides in a */
+/* valid location */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* _txm_module_manager_kernel_dispatch Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_memory_check(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE object_ptr, ULONG object_size)
+{
+
+ /* Is the object pointer from the module manager's object pool? */
+ if ((_txm_module_manager_object_pool_created == TX_TRUE) &&
+ (object_ptr >= (ALIGN_TYPE) _txm_module_manager_object_pool.tx_byte_pool_start) &&
+ ((object_ptr+object_size) <= (ALIGN_TYPE) (_txm_module_manager_object_pool.tx_byte_pool_start + _txm_module_manager_object_pool.tx_byte_pool_size)))
+ {
+ /* Object is from manager object pool. */
+ return(TX_SUCCESS);
+ }
+
+ /* If memory protection is not required, check if object is in module data. */
+ else if (!(module_instance -> txm_module_instance_property_flags & TXM_MODULE_MEMORY_PROTECTION))
+ {
+ if ((object_ptr >= (ALIGN_TYPE) module_instance -> txm_module_instance_data_start) &&
+ ((object_ptr+object_size) <= (ALIGN_TYPE) module_instance -> txm_module_instance_data_end))
+ {
+ /* Object is from the local module memory. */
+ return(TX_SUCCESS);
+ }
+ }
+
+ /* Object is from invalid memory. */
+ return(TXM_MODULE_INVALID_MEMORY);
+
+}
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_created_object_check PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This functions checks if the specified object was created by the */
+/* specified module */
+/* */
+/* INPUT */
+/* */
+/* module_instance The module instance to check */
+/* object_ptr The object to check */
+/* */
+/* OUTPUT */
+/* */
+/* status Whether the module created the */
+/* object */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* txm_module_manager*_stop Module manager stop functions */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UCHAR _txm_module_manager_created_object_check(TXM_MODULE_INSTANCE *module_instance, VOID *object_ptr)
+{
+
+TXM_MODULE_ALLOCATED_OBJECT *allocated_object_ptr;
+
+ /* Determine if the socket control block is inside the module. */
+ if ( (((CHAR *) object_ptr) >= ((CHAR *) module_instance -> txm_module_instance_data_start)) &&
+ (((CHAR *) object_ptr) < ((CHAR *) module_instance -> txm_module_instance_data_end)))
+ {
+ return TX_TRUE;
+ }
+
+ /* Determine if this object control block was allocated by this module instance. */
+ else if (_txm_module_manager_object_pool_created)
+ {
+
+ /* Determine if the current object is from the pool of dynamically allocated objects. */
+ if ((((UCHAR *) object_ptr) >= _txm_module_manager_object_pool.tx_byte_pool_start) &&
+ (((UCHAR *) object_ptr) < (_txm_module_manager_object_pool.tx_byte_pool_start + _txm_module_manager_object_pool.tx_byte_pool_size)))
+ {
+
+ /* Pickup object pointer. */
+ allocated_object_ptr = (TXM_MODULE_ALLOCATED_OBJECT *) object_ptr;
+
+ /* Move back to get the header information. */
+ allocated_object_ptr--;
+
+ /* Now determine if this object belongs to this module. */
+ if (allocated_object_ptr -> txm_module_allocated_object_module_instance == module_instance)
+ {
+ return TX_TRUE;
+ }
+ }
+ }
+
+ return TX_FALSE;
+}
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_object_size_check PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function checks if the specified object's size matches what is */
+/* inside the object pool. */
+/* */
+/* INPUT */
+/* */
+/* object_ptr Pointer to object to check */
+/* object_size Size of the object to check */
+/* */
+/* OUTPUT */
+/* */
+/* status Whether the object's size matches */
+/* what's inside the object pool */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* _txm_module_manager_kernel_dispatch Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_size_check(ALIGN_TYPE object_ptr, ULONG object_size)
+{
+TXM_MODULE_ALLOCATED_OBJECT *module_allocated_object_ptr;
+UINT return_value;
+
+ /* Pickup the allocated object pointer. */
+ module_allocated_object_ptr = ((TXM_MODULE_ALLOCATED_OBJECT *) object_ptr) - 1;
+
+ /* Does the allocated memory match the expected object size? */
+ if (module_allocated_object_ptr -> txm_module_object_size == object_size)
+ return_value = TX_SUCCESS;
+ else
+ return_value = TXM_MODULE_INVALID_MEMORY;
+
+ return(return_value);
+}
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_name_compare PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function compares the specified object names. */
+/* */
+/* INPUT */
+/* */
+/* search_name String pointer to the object's */
+/* name being searched for */
+/* search_name_length Length of search_name */
+/* object_name String pointer to an object's name*/
+/* to compare the search name to */
+/* */
+/* OUTPUT */
+/* */
+/* status Whether the names are equal */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* *_object_pointer_get Kernel dispatch function */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_object_name_compare(CHAR *search_name, UINT search_name_length, CHAR *object_name)
+{
+
+CHAR search_name_char;
+CHAR object_name_char;
+
+
+ /* Is the object name null? Note that the search name has already been checked
+ by the caller. */
+ if (object_name == TX_NULL)
+ {
+
+ /* The strings can't match. */
+ return(TX_FALSE);
+ }
+
+ /* Loop through the names. */
+ while (1)
+ {
+
+ /* Get the current characters from each name. */
+ search_name_char = *search_name;
+ object_name_char = *object_name;
+
+ /* Check for match. */
+ if (search_name_char == object_name_char)
+ {
+
+ /* Are they null-terminators? */
+ if (search_name_char == '\0')
+ {
+
+ /* The strings match. */
+ return(TX_TRUE);
+ }
+ }
+ else
+ {
+
+ /* The strings don't match. */
+ return(TX_FALSE);
+ }
+
+ /* Are we at the end of the search name? */
+ if (search_name_length == 0)
+ {
+
+ /* The strings don't match. */
+ return(TX_FALSE);
+ }
+
+ /* Move to next character. */
+ search_name++;
+ object_name++;
+ search_name_length--;
+ }
+}
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _txm_module_manager_util_code_allocation_size_and_alignment_get */
+/* PORTABLE C */
+/* 6.0.1 */
+/* AUTHOR */
+/* */
+/* Scott Larson, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the required alignment and allocation size */
+/* for a module's code area. */
+/* */
+/* INPUT */
+/* */
+/* module_preamble Preamble of module to return code */
+/* values for */
+/* code_alignment_dest Address to return code alignment */
+/* code_allocation_size_desk Address to return code allocation */
+/* size */
+/* */
+/* OUTPUT */
+/* */
+/* status Success if no math overflow */
+/* occurred during calculation */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* txm_module_manager_*_load Module load functions */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 06-30-2020 Scott Larson Initial Version 6.0.1 */
+/* */
+/**************************************************************************/
+UINT _txm_module_manager_util_code_allocation_size_and_alignment_get(TXM_MODULE_PREAMBLE *module_preamble,
+ ULONG *code_alignment_dest, ULONG *code_allocation_size_dest)
+{
+
+ULONG code_size;
+ULONG code_alignment;
+ULONG data_size_ignored;
+ULONG data_alignment_ignored;
+
+
+ /* Pickup the module code size. */
+ code_size = module_preamble -> txm_module_preamble_code_size;
+
+ /* Adjust the size of the module elements to be aligned to the default alignment. */
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(code_size, TXM_MODULE_CODE_ALIGNMENT, code_size);
+ code_size = ((code_size - 1)/TXM_MODULE_CODE_ALIGNMENT) * TXM_MODULE_CODE_ALIGNMENT;
+
+ /* Setup the default code and data alignments. */
+ code_alignment = (ULONG) TXM_MODULE_CODE_ALIGNMENT;
+
+ /* Get the port-specific alignment for the code size. Note we only want code so we pass 'null' values for data. */
+ data_size_ignored = 1;
+ data_alignment_ignored = 1;
+ TXM_MODULE_MANAGER_ALIGNMENT_ADJUST(module_preamble, code_size, code_alignment, data_size_ignored, data_alignment_ignored)
+
+ /* Calculate the code memory allocation size. */
+ TXM_MODULE_MANAGER_UTIL_MATH_ADD_ULONG(code_size, code_alignment, *code_allocation_size_dest);
+
+ /* Write the alignment result into the caller's destination address. */
+ *code_alignment_dest = code_alignment;
+
+ /* Return success. */
+ return(TX_SUCCESS);
+}