Release 6.1.10
This commit is contained in:
@@ -10,70 +10,71 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** 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.1 */
|
||||
#ifndef TXM_MODULE_APPLICATION_REQUEST_CALL_NOT_USED
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_application_request PORTABLE C */
|
||||
/* 6.1.10 */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 01-31-2022 Scott Larson Modified comments and added */
|
||||
/* CALL_NOT_USED option, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
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);
|
||||
return(TX_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -26,45 +26,45 @@
|
||||
#include "tx_queue.h"
|
||||
#include "tx_thread.h"
|
||||
#include "txm_module.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_callback_request PORTABLE C */
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_callback_request PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_callback_request(TX_QUEUE *module_callback_queue, TXM_MODULE_CALLBACK_MESSAGE *callback_message)
|
||||
@@ -80,26 +80,26 @@ 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) &&
|
||||
@@ -113,62 +113,62 @@ UINT status;
|
||||
(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
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -27,45 +27,45 @@
|
||||
#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 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_event_flags_notify_trampoline PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_event_flags_notify_trampoline(TX_EVENT_FLAGS_GROUP *group_ptr)
|
||||
@@ -77,9 +77,9 @@ 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
|
||||
|
||||
@@ -90,9 +90,9 @@ TX_QUEUE *module_callback_queue;
|
||||
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. */
|
||||
|
||||
|
||||
/* Yes, the module is still valid. */
|
||||
|
||||
/* Pickup the module's callback message queue. */
|
||||
module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
|
||||
|
||||
@@ -113,21 +113,21 @@ TX_QUEUE *module_callback_queue;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Call the general processing that will place the callback on the
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_file_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, FX_MEDIA *media_ptr, CHAR *file_name)
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -31,46 +31,46 @@
|
||||
#include "txm_module_manager_util.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_in_place_load PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_in_place_load PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_in_place_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
#define TX_MODULE_MANAGER_INIT
|
||||
@@ -80,7 +80,7 @@ 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;
|
||||
|
||||
|
||||
@@ -97,44 +97,44 @@ ULONG _txm_module_manager_callback_error_count;
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_initialize PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_initialize PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_memory_size)
|
||||
@@ -143,11 +143,11 @@ UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_mem
|
||||
/* 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);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_mem
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
@@ -179,7 +179,7 @@ UINT _txm_module_manager_initialize(VOID *module_memory_start, ULONG module_mem
|
||||
|
||||
/* Mark the module manager as ready! */
|
||||
_txm_module_manager_ready = TX_TRUE;
|
||||
|
||||
|
||||
/* Return success. */
|
||||
return(TX_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -31,49 +31,49 @@
|
||||
#include "txm_module_manager_util.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_internal_load PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_internal_load PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_internal_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location,
|
||||
@@ -81,7 +81,7 @@ UINT _txm_module_manager_internal_load(TXM_MODULE_INSTANCE *module_instance, CH
|
||||
{
|
||||
|
||||
TX_INTERRUPT_SAVE_AREA
|
||||
|
||||
|
||||
TXM_MODULE_PREAMBLE *module_preamble;
|
||||
TXM_MODULE_INSTANCE *next_module, *previous_module;
|
||||
ULONG shell_function_adjust;
|
||||
@@ -104,11 +104,11 @@ 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);
|
||||
}
|
||||
@@ -117,15 +117,15 @@ 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);
|
||||
return(TX_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
/* Determine if the module is valid. */
|
||||
if (module_instance == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Invalid module pointer. */
|
||||
return(TX_PTR_ERROR);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ UINT status;
|
||||
/* 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);
|
||||
|
||||
@@ -175,12 +175,12 @@ UINT status;
|
||||
/* 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);
|
||||
|
||||
@@ -194,7 +194,7 @@ UINT status;
|
||||
(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);
|
||||
|
||||
@@ -227,11 +227,11 @@ UINT status;
|
||||
/* 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
|
||||
/* 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;
|
||||
@@ -239,16 +239,16 @@ UINT status;
|
||||
|
||||
/* 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
|
||||
|
||||
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 callback thread stack
|
||||
|
||||
Module's Data Area
|
||||
...
|
||||
End of Module's Data Area
|
||||
Highest Address: */
|
||||
@@ -258,11 +258,11 @@ UINT status;
|
||||
|
||||
/* 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);
|
||||
|
||||
@@ -272,10 +272,10 @@ UINT status;
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -285,7 +285,7 @@ UINT status;
|
||||
/* 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
|
||||
/* 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;
|
||||
|
||||
@@ -297,14 +297,14 @@ UINT status;
|
||||
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
|
||||
/* 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;
|
||||
|
||||
@@ -329,7 +329,7 @@ UINT status;
|
||||
|
||||
/* 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;
|
||||
@@ -358,36 +358,36 @@ UINT status;
|
||||
/* 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
|
||||
/* 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) +
|
||||
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) +
|
||||
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_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));
|
||||
(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) +
|
||||
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)
|
||||
{
|
||||
@@ -410,7 +410,7 @@ UINT status;
|
||||
|
||||
/* Setup this module's created links. */
|
||||
module_instance -> txm_module_instance_loaded_previous = previous_module;
|
||||
module_instance -> txm_module_instance_loaded_next = next_module;
|
||||
module_instance -> txm_module_instance_loaded_next = next_module;
|
||||
}
|
||||
|
||||
/* Restore interrupts. */
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "tx_queue.h"
|
||||
#include "tx_mutex.h"
|
||||
#include "tx_semaphore.h"
|
||||
#include "tx_thread.h"
|
||||
#include "tx_thread.h"
|
||||
#include "tx_timer.h"
|
||||
#include "tx_trace.h"
|
||||
#include "txm_module.h"
|
||||
@@ -41,7 +41,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_kernel_dispatch PORTABLE C */
|
||||
/* 6.1.6 */
|
||||
/* 6.1.10 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -89,6 +89,9 @@
|
||||
/* added optional defines to */
|
||||
/* remove unneeded functions, */
|
||||
/* resulting in version 6.1.6 */
|
||||
/* 01-31-2022 Scott Larson Modified comments and added */
|
||||
/* CALL_NOT_USED option, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
ALIGN_TYPE _txm_module_manager_kernel_dispatch(ULONG kernel_request, ALIGN_TYPE param_0, ALIGN_TYPE param_1, ALIGN_TYPE param_2)
|
||||
@@ -437,7 +440,7 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef TXM_QUEUE_SEND_CALL_NOT_USED
|
||||
case TXM_QUEUE_SEND_CALL:
|
||||
{
|
||||
@@ -888,14 +891,16 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
return_value = (ALIGN_TYPE) _txm_module_manager_port_dispatch(module_instance, kernel_request, param_0, param_1, param_2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Determine if an application request is present. */
|
||||
|
||||
#ifndef TXM_MODULE_APPLICATION_REQUEST_CALL_NOT_USED
|
||||
/* 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TXM_MODULE_ENABLE_NETX
|
||||
/* Determine if there is a NetX request. */
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -27,43 +27,43 @@
|
||||
#include "txm_module.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_maximum_module_priority_set PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_maximum_module_priority_set PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_maximum_module_priority_set(TXM_MODULE_INSTANCE *module_instance, UINT priority)
|
||||
@@ -72,45 +72,45 @@ UINT _txm_module_manager_maximum_module_priority_set(TXM_MODULE_INSTANCE *module
|
||||
if (_txm_module_manager_ready != TX_TRUE)
|
||||
{
|
||||
/* Module manager has not been initialized. */
|
||||
return(TX_NOT_AVAILABLE);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_memory_load(TXM_MODULE_INSTANCE *module_instance, CHAR *module_name, VOID *module_location)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_object_allocate PORTABLE C */
|
||||
/* _txm_module_manager_object_allocate PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
@@ -36,16 +36,16 @@
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function allocates memory for an object from the memory pool */
|
||||
/* supplied to txm_module_manager_initialize. */
|
||||
/* 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_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 */
|
||||
@@ -66,7 +66,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_object_allocate(VOID **object_ptr_ptr, ULONG object_size, TXM_MODULE_INSTANCE *module_instance)
|
||||
@@ -98,7 +98,7 @@ UINT return_value;
|
||||
|
||||
/* 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,
|
||||
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. */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
#include "tx_api.h"
|
||||
#include "tx_thread.h"
|
||||
#include "tx_thread.h"
|
||||
#include "txm_module.h"
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -38,11 +38,11 @@
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function deallocates a previously allocated object. */
|
||||
/* This function deallocates a previously allocated object. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* object_ptr Object pointer to deallocate */
|
||||
/* object_ptr Object pointer to deallocate */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
@@ -63,7 +63,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_object_deallocate(VOID *object_ptr)
|
||||
@@ -78,18 +78,18 @@ UINT return_value;
|
||||
/* 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))
|
||||
{
|
||||
@@ -98,8 +98,8 @@ UINT return_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Unlink the node. */
|
||||
|
||||
/* Unlink the node. */
|
||||
if ((--module_instance -> txm_module_instance_object_list_count) == 0)
|
||||
{
|
||||
/* Only allocated object, just set the allocated list to NULL. */
|
||||
@@ -112,16 +112,16 @@ UINT return_value;
|
||||
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;
|
||||
module_instance -> txm_module_instance_object_list_head = next_object;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release the object memory. */
|
||||
|
||||
/* Release the object memory. */
|
||||
return_value = (ULONG) _txe_byte_release((VOID *) module_allocated_object_ptr);
|
||||
}
|
||||
}
|
||||
@@ -130,9 +130,9 @@ UINT return_value;
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_object_pointer_get(UINT object_type, CHAR *name, VOID **object_ptr)
|
||||
@@ -84,7 +84,7 @@ UINT _txm_module_manager_object_pointer_get(UINT object_type, CHAR *name, VOID
|
||||
|
||||
UINT status;
|
||||
|
||||
/* Call the secure version of this function with the maximum length
|
||||
/* 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);
|
||||
|
||||
@@ -93,14 +93,14 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.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;
|
||||
@@ -117,7 +117,7 @@ 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);
|
||||
}
|
||||
@@ -133,36 +133,36 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
|
||||
/* 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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
@@ -171,32 +171,32 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
}
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next timer. */
|
||||
timer_ptr = timer_ptr -> tx_timer_created_next;
|
||||
}
|
||||
@@ -212,22 +212,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next queue. */
|
||||
queue_ptr = queue_ptr -> tx_queue_created_next;
|
||||
}
|
||||
@@ -243,22 +243,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next event flags group. */
|
||||
events_ptr = events_ptr -> tx_event_flags_group_created_next;
|
||||
}
|
||||
@@ -274,22 +274,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next semaphore. */
|
||||
semaphore_ptr = semaphore_ptr -> tx_semaphore_created_next;
|
||||
}
|
||||
@@ -305,22 +305,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next mutex. */
|
||||
mutex_ptr = mutex_ptr -> tx_mutex_created_next;
|
||||
}
|
||||
@@ -353,22 +353,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next block pool. */
|
||||
block_pool_ptr = block_pool_ptr -> tx_block_pool_created_next;
|
||||
}
|
||||
@@ -401,22 +401,22 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
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;
|
||||
status = TX_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the counter. */
|
||||
i++;
|
||||
|
||||
|
||||
/* Move to next byte pool. */
|
||||
byte_pool_ptr = byte_pool_ptr -> tx_byte_pool_created_next;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
/* 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);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
/* 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);
|
||||
}
|
||||
@@ -457,7 +457,7 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
/* 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);
|
||||
}
|
||||
@@ -469,7 +469,7 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
/* 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);
|
||||
}
|
||||
@@ -480,13 +480,13 @@ TXM_MODULE_INSTANCE *module_instance;
|
||||
/* 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;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Disable interrupts. */
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -26,56 +26,56 @@
|
||||
#include "txm_module.h"
|
||||
#include "tx_byte_pool.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* txm_module_manager_object_pool_create PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* txm_module_manager_object_pool_create PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.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. */
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -10,57 +10,57 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
#include "txm_module.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_properties_get PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_properties_get PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_properties_get(TXM_MODULE_INSTANCE *module_instance, ULONG *module_properties_ptr)
|
||||
@@ -69,15 +69,15 @@ UINT _txm_module_manager_properties_get(TXM_MODULE_INSTANCE *module_instance, U
|
||||
/* 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);
|
||||
return(TX_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
/* Determine if the module is valid. */
|
||||
if (module_instance == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Invalid module pointer. */
|
||||
return(TX_PTR_ERROR);
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -28,41 +28,41 @@
|
||||
#include "txm_module.h"
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_queue_notify_trampoline PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_queue_notify_trampoline PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_queue_notify_trampoline(TX_QUEUE *queue_ptr)
|
||||
@@ -74,9 +74,9 @@ 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
|
||||
|
||||
@@ -87,9 +87,9 @@ TX_QUEUE *module_callback_queue;
|
||||
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. */
|
||||
|
||||
|
||||
/* Yes, the module is still valid. */
|
||||
|
||||
/* Pickup the module's callback message queue. */
|
||||
module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
|
||||
|
||||
@@ -107,26 +107,26 @@ TX_QUEUE *module_callback_queue;
|
||||
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
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -28,42 +28,42 @@
|
||||
#include "txm_module.h"
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_semaphore_notify_trampoline PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_semaphore_notify_trampoline PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_semaphore_notify_trampoline(TX_SEMAPHORE *semaphore_ptr)
|
||||
@@ -75,9 +75,9 @@ 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
|
||||
|
||||
@@ -88,9 +88,9 @@ TX_QUEUE *module_callback_queue;
|
||||
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. */
|
||||
|
||||
|
||||
/* Yes, the module is still valid. */
|
||||
|
||||
/* Pickup the module's callback message queue. */
|
||||
module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
|
||||
|
||||
@@ -108,24 +108,24 @@ TX_QUEUE *module_callback_queue;
|
||||
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
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -75,22 +75,22 @@
|
||||
/**************************************************************************/
|
||||
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);
|
||||
return(TX_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
/* Determine if the module is valid. */
|
||||
if (module_instance == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Invalid module pointer. */
|
||||
return(TX_PTR_ERROR);
|
||||
}
|
||||
@@ -108,11 +108,11 @@ UINT status;
|
||||
/* 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);
|
||||
|
||||
@@ -124,7 +124,7 @@ UINT status;
|
||||
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);
|
||||
|
||||
@@ -133,13 +133,13 @@ UINT status;
|
||||
}
|
||||
|
||||
/* 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)),
|
||||
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);
|
||||
|
||||
@@ -147,7 +147,7 @@ UINT status;
|
||||
return(TX_START_ERROR);
|
||||
}
|
||||
|
||||
/* Create the module start thread. */
|
||||
/* 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,
|
||||
@@ -158,14 +158,14 @@ UINT status;
|
||||
(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,
|
||||
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));
|
||||
|
||||
@@ -173,10 +173,10 @@ UINT status;
|
||||
_tx_mutex_put(&_txm_module_manager_mutex);
|
||||
|
||||
/* Return the error status. */
|
||||
return(status);
|
||||
return(status);
|
||||
}
|
||||
|
||||
/* Create the module callback thread. */
|
||||
/* 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,
|
||||
@@ -187,20 +187,20 @@ UINT status;
|
||||
(UINT) module_instance -> txm_module_instance_callback_priority,
|
||||
(UINT) module_instance -> txm_module_instance_callback_priority,
|
||||
TX_NO_TIME_SLICE,
|
||||
TX_DONT_START,
|
||||
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));
|
||||
|
||||
@@ -208,7 +208,7 @@ UINT status;
|
||||
_tx_mutex_put(&_txm_module_manager_mutex);
|
||||
|
||||
/* Return the error status. */
|
||||
return(status);
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -28,43 +28,43 @@
|
||||
#include "txm_module.h"
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_thread_notify_trampoline PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_thread_notify_trampoline PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_thread_notify_trampoline(TX_THREAD *thread_ptr, UINT type)
|
||||
@@ -77,9 +77,9 @@ 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
|
||||
|
||||
@@ -97,9 +97,9 @@ TXM_MODULE_THREAD_ENTRY_INFO *thread_info;
|
||||
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. */
|
||||
|
||||
|
||||
/* Yes, the module is still valid. */
|
||||
|
||||
/* Pickup the module's callback message queue. */
|
||||
module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
|
||||
|
||||
@@ -117,19 +117,19 @@ TXM_MODULE_THREAD_ENTRY_INFO *thread_info;
|
||||
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
|
||||
|
||||
/* 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++;
|
||||
|
||||
@@ -139,15 +139,15 @@ TXM_MODULE_THREAD_ENTRY_INFO *thread_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Thread pointer is not valid. */
|
||||
|
||||
|
||||
/* Error, increment the error counter and return. */
|
||||
_txm_module_manager_callback_error_count++;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -27,45 +27,45 @@
|
||||
#include "tx_thread.h"
|
||||
#include "txm_module.h"
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_thread_reset PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_thread_reset PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_thread_reset(TX_THREAD *thread_ptr)
|
||||
@@ -101,7 +101,7 @@ TXM_MODULE_THREAD_ENTRY_INFO *thread_entry_info;
|
||||
{
|
||||
|
||||
/* Check for proper status of this thread to reset. */
|
||||
if (thread_ptr -> tx_thread_state != TX_COMPLETED)
|
||||
if (thread_ptr -> tx_thread_state != TX_COMPLETED)
|
||||
{
|
||||
|
||||
/* Now check for terminated state. */
|
||||
@@ -139,18 +139,18 @@ TXM_MODULE_THREAD_ENTRY_INFO *thread_entry_info;
|
||||
#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
|
||||
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
|
||||
|
||||
/* 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);
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -27,43 +27,43 @@
|
||||
#include "tx_thread.h"
|
||||
#include "tx_timer.h"
|
||||
#include "txm_module.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_timer_notify_trampoline PORTABLE C */
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_timer_notify_trampoline PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _txm_module_manager_timer_notify_trampoline(ULONG id)
|
||||
@@ -77,20 +77,20 @@ 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,
|
||||
|
||||
/* 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;
|
||||
|
||||
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;
|
||||
|
||||
@@ -98,9 +98,9 @@ CHAR *internal_ptr;
|
||||
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. */
|
||||
|
||||
|
||||
/* Yes, the module is still valid. */
|
||||
|
||||
/* Pickup the module's callback message queue. */
|
||||
module_callback_queue = &(module_instance -> txm_module_instance_callback_request_queue);
|
||||
|
||||
@@ -118,24 +118,24 @@ CHAR *internal_ptr;
|
||||
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
|
||||
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
@@ -30,50 +30,50 @@
|
||||
#include "txm_module.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_unload PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_unload PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.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;
|
||||
|
||||
@@ -81,11 +81,11 @@ 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);
|
||||
}
|
||||
@@ -94,15 +94,15 @@ CHAR *memory_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);
|
||||
return(TX_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
/* Determine if the module is valid. */
|
||||
if (module_instance == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Invalid module pointer. */
|
||||
return(TX_PTR_ERROR);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ CHAR *memory_ptr;
|
||||
/* 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);
|
||||
|
||||
@@ -141,14 +141,14 @@ CHAR *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
|
||||
|
||||
@@ -158,7 +158,7 @@ CHAR *memory_ptr;
|
||||
|
||||
/* 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. */
|
||||
@@ -180,9 +180,9 @@ CHAR *memory_ptr;
|
||||
/* 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;
|
||||
_txm_module_manager_loaded_list_ptr = next_module;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Module Manager */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
@@ -29,115 +29,115 @@
|
||||
#include "txm_module_manager_util.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_object_memory_check PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_object_memory_check PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.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) &&
|
||||
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) &&
|
||||
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 */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_created_object_check PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UCHAR _txm_module_manager_created_object_check(TXM_MODULE_INSTANCE *module_instance, VOID *object_ptr)
|
||||
@@ -179,51 +179,51 @@ TXM_MODULE_ALLOCATED_OBJECT *allocated_object_ptr;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_object_size_check PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_object_size_check PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.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;
|
||||
|
||||
@@ -232,50 +232,50 @@ UINT return_value;
|
||||
return_value = TX_SUCCESS;
|
||||
else
|
||||
return_value = TXM_MODULE_INVALID_MEMORY;
|
||||
|
||||
|
||||
return(return_value);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_name_compare PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_name_compare PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_object_name_compare(CHAR *search_name, UINT search_name_length, CHAR *object_name)
|
||||
@@ -337,48 +337,48 @@ CHAR object_name_char;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_util_code_allocation_size_and_alignment_get */
|
||||
/* PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _txm_module_manager_util_code_allocation_size_and_alignment_get */
|
||||
/* PORTABLE C */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _txm_module_manager_util_code_allocation_size_and_alignment_get(TXM_MODULE_PREAMBLE *module_preamble,
|
||||
|
||||
Reference in New Issue
Block a user