diff options
| author | Yuxin Zhou <[email protected]> | 2021-10-14 00:51:26 +0000 |
|---|---|---|
| committer | Yuxin Zhou <[email protected]> | 2021-10-14 00:51:26 +0000 |
| commit | 1af8404c54f9c8d3caa2ac3523c2a5f014aecb1c (patch) | |
| tree | 93e4f4d64ec8c21c01b77f19b8e7326e85227e3d /common | |
| parent | 215df45d4b59d4ce8606a88f566d1d426e64a84c (diff) | |
Release 6.1.9
Diffstat (limited to 'common')
177 files changed, 1606 insertions, 1564 deletions
diff --git a/common/inc/tx_api.h b/common/inc/tx_api.h index 8660c66b..d91bfc9f 100644 --- a/common/inc/tx_api.h +++ b/common/inc/tx_api.h @@ -26,7 +26,7 @@ /* APPLICATION INTERFACE DEFINITION RELEASE */ /* */ /* tx_api.h PORTABLE C */ -/* 6.1.8 */ +/* 6.1.9 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -71,10 +71,13 @@ /* resulting in version 6.1.6 */ /* 06-02-2021 Yuxin Zhou Modified comment(s), added */ /* Execution Profile support, */ -/* resulting in version 6.1.7 */ +/* resulting in version 6.1.7 */ /* 08-02-2021 Scott Larson Modified comment(s), and */ /* update patch number, */ /* resulting in version 6.1.8 */ +/* 10-15-2021 Yuxin Zhou Modified comment(s), */ +/* update patch number, */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ @@ -101,13 +104,13 @@ extern "C" { /* Define basic constants for the ThreadX kernel. */ -/* Define the major/minor version information that can be used by the application +/* Define the major/minor version information that can be used by the application and the ThreadX source as well. */ - + #define AZURE_RTOS_THREADX #define THREADX_MAJOR_VERSION 6 #define THREADX_MINOR_VERSION 1 -#define THREADX_PATCH_VERSION 8 +#define THREADX_PATCH_VERSION 9 /* Define the following symbol for backward compatibility */ #define EL_PRODUCT_THREADX @@ -214,16 +217,16 @@ extern "C" { #endif -/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are: - - ThreadX events: 1-199 +/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are: + + ThreadX events: 1-199 FileX events: 200-299 NetX events: 300-599 USBX events: 600-999 GUIX events: 1000-1500 - - User-defined event numbers start at 4096 and continue through 65535, as defined by the constants - TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based + + User-defined event numbers start at 4096 and continue through 65535, as defined by the constants + TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based on these constants in case the user event number assignment is changed in future releases. */ #define TX_TRACE_USER_EVENT_START 4096 /* I1, I2, I3, I4 are user defined */ @@ -249,7 +252,7 @@ extern "C" { /* Define basic alignment type used in block and byte pool operations. This data type must be at least 32-bits in size and also be large enough to hold a pointer type. */ - + #ifndef ALIGN_TYPE_DEFINED #define ALIGN_TYPE ULONG #endif @@ -258,10 +261,10 @@ extern "C" { /* Define the control block definitions for all system objects. */ -/* Define the basic timer management structures. These are the structures +/* Define the basic timer management structures. These are the structures used to manage thread sleep, timeout, and user timer requests. */ -/* Determine if the internal timer control block has an extension defined. If not, +/* Determine if the internal timer control block has an extension defined. If not, define the extension to whitespace. */ #ifndef TX_TIMER_INTERNAL_EXTENSION @@ -299,7 +302,7 @@ typedef struct TX_TIMER_INTERNAL_STRUCT } TX_TIMER_INTERNAL; -/* Determine if the timer control block has an extension defined. If not, +/* Determine if the timer control block has an extension defined. If not, define the extension to whitespace. */ #ifndef TX_TIMER_EXTENSION @@ -358,7 +361,7 @@ typedef struct TX_TIMER_STRUCT typedef struct TX_THREAD_STRUCT { /* The first section of the control block contains critical - information that is referenced by the port-specific + information that is referenced by the port-specific assembly language code. Any changes in this section could necessitate changes in the assembly language. */ @@ -378,38 +381,38 @@ typedef struct TX_THREAD_STRUCT /***************************************************************/ - /* Define the first port extension in the thread control block. This + /* Define the first port extension in the thread control block. This is typically defined to whitespace or a pointer type in tx_port.h. */ TX_THREAD_EXTENSION_0 - + CHAR *tx_thread_name; /* Pointer to thread's name */ UINT tx_thread_priority; /* Priority of thread (0-1023) */ UINT tx_thread_state; /* Thread's execution state */ UINT tx_thread_delayed_suspend; /* Delayed suspend flag */ UINT tx_thread_suspending; /* Thread suspending flag */ UINT tx_thread_preempt_threshold; /* Preemption threshold */ - - /* Define the thread schedule hook. The usage of this is port/application specific, + + /* Define the thread schedule hook. The usage of this is port/application specific, but when used, the function pointer designated is called whenever the thread is scheduled and unscheduled. */ VOID (*tx_thread_schedule_hook)(struct TX_THREAD_STRUCT *thread_ptr, ULONG id); /* Nothing after this point is referenced by the target-specific - assembly language. Hence, information after this point can - be added to the control block providing the complete system + assembly language. Hence, information after this point can + be added to the control block providing the complete system is recompiled. */ /* Define the thread's entry point and input parameter. */ VOID (*tx_thread_entry)(ULONG id); ULONG tx_thread_entry_parameter; - /* Define the thread's timer block. This is used for thread + /* Define the thread's timer block. This is used for thread sleep and timeout requests. */ TX_TIMER_INTERNAL tx_thread_timer; /* Define the thread's cleanup function and associated data. This - is used to cleanup various data structures when a thread - suspension is lifted or terminated either by the user or + is used to cleanup various data structures when a thread + suspension is lifted or terminated either by the user or a timeout. */ VOID (*tx_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *thread_ptr, ULONG suspension_sequence); VOID *tx_thread_suspend_control_block; @@ -421,17 +424,17 @@ typedef struct TX_THREAD_STRUCT UINT tx_thread_suspend_option; UINT tx_thread_suspend_status; - /* Define the second port extension in the thread control block. This + /* Define the second port extension in the thread control block. This is typically defined to whitespace or a pointer type in tx_port.h. */ TX_THREAD_EXTENSION_1 - /* Define pointers to the next and previous threads in the + /* Define pointers to the next and previous threads in the created list. */ struct TX_THREAD_STRUCT *tx_thread_created_next, *tx_thread_created_previous; - /* Define the third port extension in the thread control block. This + /* Define the third port extension in the thread control block. This is typically defined to whitespace in tx_port.h. */ TX_THREAD_EXTENSION_2 @@ -439,14 +442,14 @@ typedef struct TX_THREAD_STRUCT #ifndef TX_NO_FILEX_POINTER VOID *tx_thread_filex_ptr; #endif - + /* Define the priority inheritance variables. These will be used - to manage priority inheritance changes applied to this thread + to manage priority inheritance changes applied to this thread as a result of mutex get operations. */ UINT tx_thread_user_priority; UINT tx_thread_user_preempt_threshold; UINT tx_thread_inherit_priority; - + /* Define the owned mutex count and list head pointer. */ UINT tx_thread_owned_mutex_count; struct TX_MUTEX_STRUCT @@ -460,7 +463,7 @@ typedef struct TX_THREAD_STRUCT /* Define the number of times this thread suspends. */ ULONG tx_thread_performance_suspend_count; - /* Define the number of times this thread is preempted by calling + /* Define the number of times this thread is preempted by calling a ThreadX API service. */ ULONG tx_thread_performance_solicited_preemption_count; @@ -495,33 +498,33 @@ typedef struct TX_THREAD_STRUCT #ifndef TX_DISABLE_NOTIFY_CALLBACKS - /* Define the application callback routine used to notify the application when + /* Define the application callback routine used to notify the application when the thread is entered or exits. */ VOID (*tx_thread_entry_exit_notify)(struct TX_THREAD_STRUCT *thread_ptr, UINT type); #endif - /* Define the fourth port extension in the thread control block. This + /* Define the fourth port extension in the thread control block. This is typically defined to whitespace in tx_port.h. */ TX_THREAD_EXTENSION_3 /* Define variables for supporting execution profile. */ /* Note that in ThreadX 5.x, user would define TX_ENABLE_EXECUTION_CHANGE_NOTIFY and use TX_THREAD_EXTENSION_3 - to define the following two variables. + to define the following two variables. For Azure RTOS 6, user shall use TX_EXECUTION_PROFILE_ENABLE instead of TX_ENABLE_EXECUTION_CHANGE_NOTIFY, and SHALL NOT add variables to TX_THREAD_EXTENSION_3. */ #if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY)) - unsigned long long tx_thread_execution_time_total; - unsigned long long tx_thread_execution_time_last_start; + unsigned long long tx_thread_execution_time_total; + unsigned long long tx_thread_execution_time_last_start; #endif - /* Define suspension sequence number. This is used to ensure suspension is still valid when + /* Define suspension sequence number. This is used to ensure suspension is still valid when cleanup routine executes. */ ULONG tx_thread_suspension_sequence; - /* Define the user extension field. This typically is defined - to white space, but some ports of ThreadX may need to have - additional fields in the thread control block. This is + /* Define the user extension field. This typically is defined + to white space, but some ports of ThreadX may need to have + additional fields in the thread control block. This is defined in the file tx_port.h. */ TX_THREAD_USER_EXTENSION @@ -583,14 +586,14 @@ typedef struct TX_BLOCK_POOL_STRUCT ULONG tx_block_pool_performance_timeout_count; #endif - /* Define the port extension in the block pool control block. This + /* Define the port extension in the block pool control block. This is typically defined to whitespace in tx_port.h. */ TX_BLOCK_POOL_EXTENSION } TX_BLOCK_POOL; -/* Determine if the byte allocate extension is defined. If not, define the +/* Determine if the byte allocate extension is defined. If not, define the extension to whitespace. */ #ifndef TX_BYTE_ALLOCATE_EXTENSION @@ -598,7 +601,7 @@ typedef struct TX_BLOCK_POOL_STRUCT #endif -/* Determine if the byte release extension is defined. If not, define the +/* Determine if the byte release extension is defined. If not, define the extension to whitespace. */ #ifndef TX_BYTE_RELEASE_EXTENSION @@ -678,7 +681,7 @@ typedef struct TX_BYTE_POOL_STRUCT ULONG tx_byte_pool_performance_timeout_count; #endif - /* Define the port extension in the byte pool control block. This + /* Define the port extension in the byte pool control block. This is typically defined to whitespace in tx_port.h. */ TX_BYTE_POOL_EXTENSION @@ -696,7 +699,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT /* Define the event flags group's name. */ CHAR *tx_event_flags_group_name; - /* Define the actual current event flags in this group. A zero in a + /* Define the actual current event flags in this group. A zero in a particular bit indicates the event flag is not set. */ ULONG tx_event_flags_group_current; @@ -735,19 +738,19 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT #ifndef TX_DISABLE_NOTIFY_CALLBACKS - /* Define the application callback routine used to notify the application when + /* Define the application callback routine used to notify the application when an event flag is set. */ VOID (*tx_event_flags_group_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *group_ptr); #endif - /* Define the port extension in the event flags group control block. This + /* Define the port extension in the event flags group control block. This is typically defined to whitespace in tx_port.h. */ TX_EVENT_FLAGS_GROUP_EXTENSION } TX_EVENT_FLAGS_GROUP; -/* Determine if the mutex put extension 1 is defined. If not, define the +/* Determine if the mutex put extension 1 is defined. If not, define the extension to whitespace. */ #ifndef TX_MUTEX_PUT_EXTENSION_1 @@ -755,7 +758,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT #endif -/* Determine if the mutex put extension 2 is defined. If not, define the +/* Determine if the mutex put extension 2 is defined. If not, define the extension to whitespace. */ #ifndef TX_MUTEX_PUT_EXTENSION_2 @@ -763,7 +766,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT #endif -/* Determine if the mutex priority change extension is defined. If not, define the +/* Determine if the mutex priority change extension is defined. If not, define the extension to whitespace. */ #ifndef TX_MUTEX_PRIORITY_CHANGE_EXTENSION @@ -837,7 +840,7 @@ typedef struct TX_MUTEX_STRUCT ULONG tx_mutex_performance__priority_inheritance_count; #endif - /* Define the port extension in the mutex control block. This + /* Define the port extension in the mutex control block. This is typically defined to whitespace in tx_port.h. */ TX_MUTEX_EXTENSION @@ -866,7 +869,7 @@ typedef struct TX_QUEUE_STRUCT UINT tx_queue_enqueued; UINT tx_queue_available_storage; - /* Define pointers that represent the start and end for the queue's + /* Define pointers that represent the start and end for the queue's message area. */ ULONG *tx_queue_start; ULONG *tx_queue_end; @@ -911,12 +914,12 @@ typedef struct TX_QUEUE_STRUCT #ifndef TX_DISABLE_NOTIFY_CALLBACKS - /* Define the application callback routine used to notify the application when + /* Define the application callback routine used to notify the application when the a message is sent to the queue. */ VOID (*tx_queue_send_notify)(struct TX_QUEUE_STRUCT *queue_ptr); #endif - /* Define the port extension in the queue control block. This + /* Define the port extension in the queue control block. This is typically defined to whitespace in tx_port.h. */ TX_QUEUE_EXTENSION @@ -966,29 +969,29 @@ typedef struct TX_SEMAPHORE_STRUCT #ifndef TX_DISABLE_NOTIFY_CALLBACKS - /* Define the application callback routine used to notify the application when + /* Define the application callback routine used to notify the application when the a semaphore is put. */ VOID (*tx_semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *semaphore_ptr); #endif - /* Define the port extension in the semaphore control block. This + /* Define the port extension in the semaphore control block. This is typically defined to whitespace in tx_port.h. */ TX_SEMAPHORE_EXTENSION } TX_SEMAPHORE; -/* Define the system API mappings based on the error checking - selected by the user. Note: this section is only applicable to +/* Define the system API mappings based on the error checking + selected by the user. Note: this section is only applicable to application source code, hence the conditional that turns off this stuff when the include file is processed by the ThreadX source. */ #ifndef TX_SOURCE_CODE -/* Determine if error checking is desired. If so, map API functions +/* Determine if error checking is desired. If so, map API functions to the appropriate error checking front-ends. Otherwise, map API - functions to the core functions that actually perform the work. + functions to the core functions that actually perform the work. Note: error checking is enabled by default. */ #ifdef TX_DISABLE_ERROR_CHECKING @@ -1362,8 +1365,8 @@ UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, VOID *pool_start, ULONG pool_size); UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr); -UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, - ULONG *total_blocks, TX_THREAD **first_suspended, +UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, + ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool); UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases, ULONG *suspensions, ULONG *timeouts); @@ -1373,15 +1376,15 @@ UINT _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr); UINT _tx_block_release(VOID *block_ptr); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option); UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size); UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr); -UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, - ULONG *total_blocks, TX_THREAD **first_suspended, +UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, + ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool); UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr); UINT _txe_block_release(VOID *block_ptr); @@ -1390,8 +1393,8 @@ UINT _txr_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG UINT _txr_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size); UINT _txr_block_pool_delete(TX_BLOCK_POOL *pool_ptr); -UINT _txr_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, - ULONG *total_blocks, TX_THREAD **first_suspended, +UINT _txr_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, + ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool); UINT _txr_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr); UINT _txr_block_release(VOID *block_ptr); @@ -1405,8 +1408,8 @@ UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG m UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size); UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr); -UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, - ULONG *fragments, TX_THREAD **first_suspended, +UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, + ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool); UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases, ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts); @@ -1416,7 +1419,7 @@ UINT _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr); UINT _tx_byte_release(VOID *memory_ptr); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, @@ -1424,8 +1427,8 @@ UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size); UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr); -UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, - ULONG *fragments, TX_THREAD **first_suspended, +UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, + ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool); UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr); UINT _txe_byte_release(VOID *memory_ptr); @@ -1435,8 +1438,8 @@ UINT _txr_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG UINT _txr_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size); UINT _txr_byte_pool_delete(TX_BYTE_POOL *pool_ptr); -UINT _txr_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, - ULONG *fragments, TX_THREAD **first_suspended, +UINT _txr_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, + ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool); UINT _txr_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr); UINT _txr_byte_release(VOID *memory_ptr); @@ -1449,29 +1452,29 @@ UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_p UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); -UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group); UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts); UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts); -UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, +UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option); UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size); UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); -UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group); -UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, +UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option); UINT _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); #ifdef TX_ENABLE_MULTI_ERROR_CHECKING @@ -1479,10 +1482,10 @@ UINT _txr_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ UINT _txr_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); UINT _txr_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); -UINT _txr_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txr_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group); -UINT _txr_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, +UINT _txr_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option); UINT _txr_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); #endif @@ -1498,8 +1501,8 @@ VOID _tx_initialize_kernel_enter(VOID); UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit); UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr); UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option); -UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex); UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances); @@ -1509,14 +1512,14 @@ UINT _tx_mutex_prioritize(TX_MUTEX *mutex_ptr); UINT _tx_mutex_put(TX_MUTEX *mutex_ptr); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size); UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr); UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option); -UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex); UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr); UINT _txe_mutex_put(TX_MUTEX *mutex_ptr); @@ -1524,8 +1527,8 @@ UINT _txe_mutex_put(TX_MUTEX *mutex_ptr); UINT _txr_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size); UINT _txr_mutex_delete(TX_MUTEX *mutex_ptr); UINT _txr_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option); -UINT _txr_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txr_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex); UINT _txr_mutex_prioritize(TX_MUTEX *mutex_ptr); UINT _txr_mutex_put(TX_MUTEX *mutex_ptr); @@ -1534,7 +1537,7 @@ UINT _txr_mutex_put(TX_MUTEX *mutex_ptr); /* Define queue management function prototypes. */ -UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, +UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size); UINT _tx_queue_delete(TX_QUEUE *queue_ptr); UINT _tx_queue_flush(TX_QUEUE *queue_ptr); @@ -1551,10 +1554,10 @@ UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify) UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ -UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, +UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size, UINT queue_control_block_size); UINT _txe_queue_delete(TX_QUEUE *queue_ptr); UINT _txe_queue_flush(TX_QUEUE *queue_ptr); @@ -1566,7 +1569,7 @@ UINT _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_op UINT _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)); UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); #ifdef TX_ENABLE_MULTI_ERROR_CHECKING -UINT _txr_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, +UINT _txr_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size, UINT queue_control_block_size); UINT _txr_queue_delete(TX_QUEUE *queue_ptr); UINT _txr_queue_flush(TX_QUEUE *queue_ptr); @@ -1586,8 +1589,8 @@ UINT _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count); UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr); UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option); -UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore); UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts); @@ -1597,15 +1600,15 @@ UINT _tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr); UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling); UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size); UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr); UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option); -UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore); UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr); UINT _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr); @@ -1615,8 +1618,8 @@ UINT _txr_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceilin UINT _txr_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size); UINT _txr_semaphore_delete(TX_SEMAPHORE *semaphore_ptr); UINT _txr_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option); -UINT _txr_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txr_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore); UINT _txr_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr); UINT _txr_semaphore_put(TX_SEMAPHORE *semaphore_ptr); @@ -1628,19 +1631,19 @@ UINT _txr_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaph VOID _tx_thread_context_save(VOID); VOID _tx_thread_context_restore(VOID); -UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, +UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input), ULONG entry_input, - VOID *stack_start, ULONG stack_size, - UINT priority, UINT preempt_threshold, + VOID *stack_start, ULONG stack_size, + UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start); UINT _tx_thread_delete(TX_THREAD *thread_ptr); UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)); TX_THREAD *_tx_thread_identify(VOID); -UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, - UINT *priority, UINT *preemption_threshold, ULONG *time_slice, +UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, + UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread); UINT _tx_thread_interrupt_control(UINT new_posture); -UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, +UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by); UINT _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions, @@ -1662,18 +1665,18 @@ UINT _tx_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_s UINT _tx_thread_wait_abort(TX_THREAD *thread_ptr); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ -UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, +UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input), ULONG entry_input, - VOID *stack_start, ULONG stack_size, - UINT priority, UINT preempt_threshold, + VOID *stack_start, ULONG stack_size, + UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start, UINT thread_control_block_size); UINT _txe_thread_delete(TX_THREAD *thread_ptr); UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)); -UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, - UINT *priority, UINT *preemption_threshold, ULONG *time_slice, +UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, + UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread); UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, UINT *old_threshold); @@ -1687,15 +1690,15 @@ UINT _txe_thread_terminate(TX_THREAD *thread_ptr); UINT _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice); UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr); #ifdef TX_ENABLE_MULTI_ERROR_CHECKING -UINT _txr_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, +UINT _txr_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input), ULONG entry_input, - VOID *stack_start, ULONG stack_size, - UINT priority, UINT preempt_threshold, + VOID *stack_start, ULONG stack_size, + UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start, UINT thread_control_block_size); UINT _txr_thread_delete(TX_THREAD *thread_ptr); UINT _txr_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)); -UINT _txr_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, - UINT *priority, UINT *preemption_threshold, ULONG *time_slice, +UINT _txr_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, + UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread); UINT _txr_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, UINT *old_threshold); @@ -1714,12 +1717,12 @@ UINT _txr_thread_wait_abort(TX_THREAD *thread_ptr); UINT _tx_timer_activate(TX_TIMER *timer_ptr); UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks); -UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, +UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG input), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate); UINT _tx_timer_deactivate(TX_TIMER *timer_ptr); UINT _tx_timer_delete(TX_TIMER *timer_ptr); -UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, +UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer); UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates, ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts); @@ -1730,27 +1733,27 @@ ULONG _tx_time_get(VOID); VOID _tx_time_set(ULONG new_time); -/* Define error checking shells for API services. These are only referenced by the +/* Define error checking shells for API services. These are only referenced by the application. */ UINT _txe_timer_activate(TX_TIMER *timer_ptr); UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks); -UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, +UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG input), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size); UINT _txe_timer_deactivate(TX_TIMER *timer_ptr); UINT _txe_timer_delete(TX_TIMER *timer_ptr); -UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, +UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer); #ifdef TX_ENABLE_MULTI_ERROR_CHECKING UINT _txr_timer_activate(TX_TIMER *timer_ptr); UINT _txr_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks); -UINT _txr_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, +UINT _txr_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG input), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size); UINT _txr_timer_deactivate(TX_TIMER *timer_ptr); UINT _txr_timer_delete(TX_TIMER *timer_ptr); -UINT _txr_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, +UINT _txr_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer); #endif @@ -1771,13 +1774,13 @@ UINT _tx_trace_interrupt_control(UINT new_posture); /* Add a default macro that can be re-defined in tx_port.h to add default processing when a thread starts. Common usage would be for enabling floating point for a thread by default, however, the additional processing could be anything defined in tx_port.h. */ - + #ifndef TX_THREAD_STARTED_EXTENSION #define TX_THREAD_STARTED_EXTENSION(thread_ptr) #endif -/* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function. +/* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function. By default, this is simply defined as whitespace. */ #ifndef TX_THREAD_STACK_ANALYZE_EXTENSION @@ -1785,7 +1788,7 @@ UINT _tx_trace_interrupt_control(UINT new_posture); #endif -/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function. +/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function. By default, this is simply defined as whitespace. */ #ifndef TX_INITIALIZE_KERNEL_ENTER_EXTENSION @@ -2240,7 +2243,7 @@ void __ghs_rnerr(char *errMsg, int stackLevels, int stackTraceDisplay, void *hex #endif /* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */ -/* Note that prior to Azure RTOS 6.1, this symbol was defined in tx_thread.h. */ +/* Note that prior to Azure RTOS 6.1, this symbol was defined in tx_thread.h. */ #ifndef TX_THREAD_GET_SYSTEM_STATE #define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state #endif diff --git a/common/inc/tx_block_pool.h b/common/inc/tx_block_pool.h index 2f72cf81..2c3be454 100644 --- a/common/inc/tx_block_pool.h +++ b/common/inc/tx_block_pool.h @@ -56,12 +56,12 @@ #define TX_BLOCK_POOL_ID ((ULONG) 0x424C4F43) -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION -/* Yes, in-line initialization is supported, remap the block memory pool +/* Yes, in-line initialization is supported, remap the block memory pool initialization function. */ #ifndef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO diff --git a/common/inc/tx_byte_pool.h b/common/inc/tx_byte_pool.h index 35320931..6bcc9c9c 100644 --- a/common/inc/tx_byte_pool.h +++ b/common/inc/tx_byte_pool.h @@ -68,12 +68,12 @@ #endif -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION -/* Yes, in-line initialization is supported, remap the byte memory pool +/* Yes, in-line initialization is supported, remap the byte memory pool initialization function. */ #ifndef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO diff --git a/common/inc/tx_event_flags.h b/common/inc/tx_event_flags.h index dceb17eb..4406003b 100644 --- a/common/inc/tx_event_flags.h +++ b/common/inc/tx_event_flags.h @@ -58,11 +58,11 @@ #define TX_EVENT_FLAGS_CLEAR_MASK ((UINT) 0x1) -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION -/* Yes, in-line initialization is supported, remap the event flag initialization +/* Yes, in-line initialization is supported, remap the event flag initialization function. */ #ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO diff --git a/common/inc/tx_initialize.h b/common/inc/tx_initialize.h index 79e5761d..625ecdb9 100644 --- a/common/inc/tx_initialize.h +++ b/common/inc/tx_initialize.h @@ -67,15 +67,15 @@ VOID _tx_initialize_low_level(VOID); /* Define the macro for adding additional port-specific global data. This macro is defined as white space, unless defined by tx_port.h. */ - + #ifndef TX_PORT_SPECIFIC_DATA #define TX_PORT_SPECIFIC_DATA #endif -/* Define the macro for adding additional port-specific pre and post initialization processing. +/* Define the macro for adding additional port-specific pre and post initialization processing. These macros is defined as white space, unless defined by tx_port.h. */ - + #ifndef TX_PORT_SPECIFIC_PRE_INITIALIZATION #define TX_PORT_SPECIFIC_PRE_INITIALIZATION #endif @@ -102,9 +102,9 @@ VOID _tx_initialize_low_level(VOID); #endif -/* Define the unused memory pointer. The value of the first available +/* Define the unused memory pointer. The value of the first available memory address is placed in this variable in the low-level - initialization function. The content of this variable is passed + initialization function. The content of this variable is passed to the application's system definition function. */ INITIALIZE_DECLARE VOID *_tx_initialize_unused_memory; diff --git a/common/inc/tx_mutex.h b/common/inc/tx_mutex.h index 8d2b0ab5..d06ec972 100644 --- a/common/inc/tx_mutex.h +++ b/common/inc/tx_mutex.h @@ -56,12 +56,12 @@ #define TX_MUTEX_ID ((ULONG) 0x4D555445) -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION -/* Yes, in-line initialization is supported, remap the mutex initialization +/* Yes, in-line initialization is supported, remap the mutex initialization function. */ #ifndef TX_MUTEX_ENABLE_PERFORMANCE_INFO diff --git a/common/inc/tx_queue.h b/common/inc/tx_queue.h index d74ce797..52c37bef 100644 --- a/common/inc/tx_queue.h +++ b/common/inc/tx_queue.h @@ -56,11 +56,11 @@ #define TX_QUEUE_ID ((ULONG) 0x51554555) -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION -/* Yes, in-line initialization is supported, remap the queue initialization +/* Yes, in-line initialization is supported, remap the queue initialization function. */ #ifndef TX_QUEUE_ENABLE_PERFORMANCE_INFO @@ -85,7 +85,7 @@ VOID _tx_queue_initialize(VOID); #endif -/* Define the message copy macro. Note that the source and destination +/* Define the message copy macro. Note that the source and destination pointers must be modified since they are used subsequently. */ #ifndef TX_QUEUE_MESSAGE_COPY diff --git a/common/inc/tx_semaphore.h b/common/inc/tx_semaphore.h index 3a50fa0f..6f6f2756 100644 --- a/common/inc/tx_semaphore.h +++ b/common/inc/tx_semaphore.h @@ -56,10 +56,10 @@ #define TX_SEMAPHORE_ID ((ULONG) 0x53454D41) -/* Determine if in-line component initialization is supported by the +/* Determine if in-line component initialization is supported by the caller. */ #ifdef TX_INVOKE_INLINE_INITIALIZATION - /* Yes, in-line initialization is supported, remap the + /* Yes, in-line initialization is supported, remap the semaphore initialization function. */ #ifndef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO #define _tx_semaphore_initialize() \ @@ -76,7 +76,7 @@ #endif #define TX_SEMAPHORE_INIT #else - /* No in-line initialization is supported, use standard + /* No in-line initialization is supported, use standard function call. */ VOID _tx_semaphore_initialize(VOID); #endif diff --git a/common/inc/tx_thread.h b/common/inc/tx_thread.h index f60e247e..a9cb35d7 100644 --- a/common/inc/tx_thread.h +++ b/common/inc/tx_thread.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* tx_thread.h PORTABLE C */ -/* 6.1.2 */ +/* 6.1.9 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -48,6 +48,9 @@ /* moved TX_THREAD_GET_SYSTEM_ */ /* STATE to tx_api.h, */ /* resulting in version 6.1.2 */ +/* 10-15-2021 Scott Larson Modified comment(s), improved */ +/* stack check error handling, */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ @@ -90,32 +93,33 @@ /* Define state change macro that can be used by run-mode debug agents to keep track of thread state changes. By default, it is mapped to white space. */ - + #ifndef TX_THREAD_STATE_CHANGE #define TX_THREAD_STATE_CHANGE(a, b) #endif -/* Define the macro to get the current thread pointer. This is particularly useful in SMP +/* Define the macro to get the current thread pointer. This is particularly useful in SMP versions of ThreadX to add additional processing. The default implementation is to simply access the global current thread pointer directly. */ - + #ifndef TX_THREAD_GET_CURRENT #define TX_THREAD_GET_CURRENT(a) (a) = _tx_thread_current_ptr; #endif -/* Define the macro to set the current thread pointer. This is particularly useful in SMP +/* Define the macro to set the current thread pointer. This is particularly useful in SMP versions of ThreadX to add additional processing. The default implementation is to simply access the global current thread pointer directly. */ - + #ifndef TX_THREAD_SET_CURRENT #define TX_THREAD_SET_CURRENT(a) _tx_thread_current_ptr = (a); #endif + /* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */ -/* This symbol is moved to tx_api.h. Therefore removed from this file. +/* This symbol is moved to tx_api.h. Therefore removed from this file. #ifndef TX_THREAD_GET_SYSTEM_STATE #define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state #endif @@ -144,10 +148,10 @@ #endif -/* Define the lowest bit set macro. Note, that this may be overridden +/* Define the lowest bit set macro. Note, that this may be overridden by a port specific definition if there is supporting assembly language instructions in the architecture. */ - + #ifndef TX_LOWEST_SET_BIT_CALCULATE #define TX_LOWEST_SET_BIT_CALCULATE(m, b) \ (b) = ((ULONG) 0); \ @@ -212,9 +216,9 @@ #endif -/* Define the default thread stack checking. This can be overridden by - a particular port, which is necessary if the stack growth is from - low address to high address (the default logic is for stacks that +/* Define the default thread stack checking. This can be overridden by + a particular port, which is necessary if the stack growth is from + low address to high address (the default logic is for stacks that grow from high address to low address. */ #ifndef TX_THREAD_STACK_CHECK @@ -311,7 +315,7 @@ THREAD_DECLARE TX_THREAD * _tx_thread_current_ptr; /* Define the variable that holds the next thread to execute. It is important - to remember that this is not necessarily equal to the current thread + to remember that this is not necessarily equal to the current thread pointer. */ THREAD_DECLARE TX_THREAD * _tx_thread_execute_ptr; @@ -328,7 +332,7 @@ THREAD_DECLARE ULONG _tx_thread_created_count; /* Define the current state variable. When this value is 0, a thread - is executing or the system is idle. Other values indicate that + is executing or the system is idle. Other values indicate that interrupt or initialization processing is active. This variable is initialized to TX_INITIALIZE_IN_PROGRESS to indicate initialization is active. */ @@ -337,15 +341,15 @@ THREAD_DECLARE volatile ULONG _tx_thread_system_state; /* Define the 32-bit priority bit-maps. There is one priority bit map for each - 32 priority levels supported. If only 32 priorities are supported there is - only one bit map. Each bit within a priority bit map represents that one + 32 priority levels supported. If only 32 priorities are supported there is + only one bit map. Each bit within a priority bit map represents that one or more threads at the associated thread priority are ready. */ THREAD_DECLARE ULONG _tx_thread_priority_maps[TX_MAX_PRIORITIES/32]; -/* Define the priority map active bit map that specifies which of the previously - defined priority maps have something set. This is only necessary if more than +/* Define the priority map active bit map that specifies which of the previously + defined priority maps have something set. This is only necessary if more than 32 priorities are supported. */ #if TX_MAX_PRIORITIES > 32 @@ -355,17 +359,17 @@ THREAD_DECLARE ULONG _tx_thread_priority_map_active; #ifndef TX_DISABLE_PREEMPTION_THRESHOLD -/* Define the 32-bit preempt priority bit maps. There is one preempt bit map - for each 32 priority levels supported. If only 32 priorities are supported - there is only one bit map. Each set set bit corresponds to a preempted priority - level that had preemption-threshold active to protect against preemption of a +/* Define the 32-bit preempt priority bit maps. There is one preempt bit map + for each 32 priority levels supported. If only 32 priorities are supported + there is only one bit map. Each set set bit corresponds to a preempted priority + level that had preemption-threshold active to protect against preemption of a range of relatively higher priority threads. */ THREAD_DECLARE ULONG _tx_thread_preempted_maps[TX_MAX_PRIORITIES/32]; -/* Define the preempt map active bit map that specifies which of the previously - defined preempt maps have something set. This is only necessary if more than +/* Define the preempt map active bit map that specifies which of the previously + defined preempt maps have something set. This is only necessary if more than 32 priorities are supported. */ #if TX_MAX_PRIORITIES > 32 @@ -373,7 +377,7 @@ THREAD_DECLARE ULONG _tx_thread_preempted_map_active; #endif #endif -/* Define the variable that holds the highest priority group ready for +/* Define the variable that holds the highest priority group ready for execution. It is important to note that this is not necessarily the same as the priority of the thread pointed to by _tx_execute_thread. */ @@ -389,13 +393,13 @@ THREAD_DECLARE TX_THREAD * _tx_thread_priority_list[TX_MAX_PRIORITIES]; /* Define the global preempt disable variable. If this is non-zero, preemption is - disabled. It is used internally by ThreadX to prevent preemption of a thread in + disabled. It is used internally by ThreadX to prevent preemption of a thread in the middle of a service that is resuming or suspending another thread. */ THREAD_DECLARE volatile UINT _tx_thread_preempt_disable; -/* Define the global function pointer for mutex cleanup on thread completion or +/* Define the global function pointer for mutex cleanup on thread completion or termination. This pointer is setup during mutex initialization. */ THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_ptr); @@ -407,7 +411,7 @@ THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_pt Bit(s) Meaning 31 TX_NOT_INTERRUPTABLE defined - 30 TX_INLINE_THREAD_RESUME_SUSPEND define + 30 TX_INLINE_THREAD_RESUME_SUSPEND define 29-24 Priority groups 1 -> 32 priorities 2 -> 64 priorities 3 -> 96 priorities @@ -437,10 +441,10 @@ THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_pt THREAD_DECLARE ULONG _tx_build_options; -#ifdef TX_ENABLE_STACK_CHECKING +#if defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) -/* Define the global function pointer for stack error handling. If a stack error is - detected and the application has registered a stack error handler, it will be +/* Define the global function pointer for stack error handling. If a stack error is + detected and the application has registered a stack error handler, it will be called via this function pointer. */ THREAD_DECLARE VOID (*_tx_thread_application_stack_error_handler)(TX_THREAD *thread_ptr); @@ -455,20 +459,20 @@ THREAD_DECLARE VOID (*_tx_thread_application_stack_error_handler)(TX THREAD_DECLARE ULONG _tx_thread_performance_resume_count; -/* Define the total number of thread suspensions. Each time a thread enters a +/* Define the total number of thread suspensions. Each time a thread enters a suspended state this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_suspend_count; -/* Define the total number of solicited thread preemptions. Each time a thread is +/* Define the total number of solicited thread preemptions. Each time a thread is preempted by directly calling a ThreadX service, this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_solicited_preemption_count; -/* Define the total number of interrupt thread preemptions. Each time a thread is - preempted as a result of an ISR calling a ThreadX service, this variable is +/* Define the total number of interrupt thread preemptions. Each time a thread is + preempted as a result of an ISR calling a ThreadX service, this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_interrupt_preemption_count; @@ -480,45 +484,45 @@ THREAD_DECLARE ULONG _tx_thread_performance_interrupt_preemption_coun THREAD_DECLARE ULONG _tx_thread_performance_priority_inversion_count; -/* Define the total number of time-slices. Each time a time-slice operation is - actually performed (another thread is setup for running) this variable is +/* Define the total number of time-slices. Each time a time-slice operation is + actually performed (another thread is setup for running) this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_time_slice_count; -/* Define the total number of thread relinquish operations. Each time a thread +/* Define the total number of thread relinquish operations. Each time a thread relinquish operation is actually performed (another thread is setup for running) this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_relinquish_count; -/* Define the total number of thread timeouts. Each time a thread has a +/* Define the total number of thread timeouts. Each time a thread has a timeout this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_timeout_count; -/* Define the total number of thread wait aborts. Each time a thread's suspension +/* Define the total number of thread wait aborts. Each time a thread's suspension is lifted by the tx_thread_wait_abort call this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_wait_abort_count; -/* Define the total number of idle system thread returns. Each time a thread returns to +/* Define the total number of idle system thread returns. Each time a thread returns to an idle system (no other thread is ready to run) this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_idle_return_count; -/* Define the total number of non-idle system thread returns. Each time a thread returns to +/* Define the total number of non-idle system thread returns. Each time a thread returns to a non-idle system (another thread is ready to run) this variable is incremented. */ THREAD_DECLARE ULONG _tx_thread_performance_non_idle_return_count; -/* Define the last TX_THREAD_EXECUTE_LOG_SIZE threads scheduled in ThreadX. This +/* Define the last TX_THREAD_EXECUTE_LOG_SIZE threads scheduled in ThreadX. This is a circular list, where the index points to the oldest entry. */ THREAD_DECLARE ULONG _tx_thread_performance__execute_log_index; diff --git a/common/inc/tx_timer.h b/common/inc/tx_timer.h index ebd4f55c..ae3a5795 100644 --- a/common/inc/tx_timer.h +++ b/common/inc/tx_timer.h @@ -79,7 +79,7 @@ VOID _tx_timer_thread_entry(ULONG timer_thread_input); #endif -/* Define the system clock value that is continually incremented by the +/* Define the system clock value that is continually incremented by the periodic timer interrupt processing. */ TIMER_DECLARE volatile ULONG _tx_timer_system_clock; @@ -116,7 +116,7 @@ TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_list_end; TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_current_ptr; -/* Define the timer expiration flag. This is used to indicate that a timer +/* Define the timer expiration flag. This is used to indicate that a timer has expired. */ TIMER_DECLARE UINT _tx_timer_expired; @@ -195,8 +195,8 @@ TIMER_DECLARE ULONG _tx_timer_performance_expiration_count; /* Define the total number of timer expiration adjustments. These are required - if the expiration time is greater than the size of the timer list. In such - cases, the timer is placed at the end of the list and then reactivated + if the expiration time is greater than the size of the timer list. In such + cases, the timer is placed at the end of the list and then reactivated as many times as necessary to finally achieve the resulting timeout. */ TIMER_DECLARE ULONG _tx_timer_performance__expiration_adjust_count; diff --git a/common/inc/tx_trace.h b/common/inc/tx_trace.h index 03e7d134..7e9c809e 100644 --- a/common/inc/tx_trace.h +++ b/common/inc/tx_trace.h @@ -78,8 +78,8 @@ #endif -/* Define the default clock source for trace event entry time stamp. The following two item are port specific. - For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock +/* Define the default clock source for trace event entry time stamp. The following two item are port specific. + For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock source constants would be: #define TX_TRACE_TIME_SOURCE *((ULONG *) 0x0a800024) @@ -101,8 +101,8 @@ /* ThreadX Trace Description. The ThreadX Trace feature is designed to capture - events in real-time in a circular event buffer. This buffer may be analyzed by other - tools. The high-level format of the Trace structure is: + events in real-time in a circular event buffer. This buffer may be analyzed by other + tools. The high-level format of the Trace structure is: [Trace Control Header ] [Trace Object Registry - Entry 0 ] @@ -115,23 +115,23 @@ */ -/* Trace Control Header. The Trace Control Header contains information that - defines the format of the Trace Object Registry as well as the location and - current entry of the Trace Buffer itself. The high-level format of the +/* Trace Control Header. The Trace Control Header contains information that + defines the format of the Trace Object Registry as well as the location and + current entry of the Trace Buffer itself. The high-level format of the Trace Control Header is: Entry Size Description [Trace ID] 4 This 4-byte field contains the ThreadX Trace Identification. If the trace buffer is valid, the - contents are 0x54585442 (TXTB). Since it is written as + contents are 0x54585442 (TXTB). Since it is written as a 32-bit unsigned word, this value is also used to - determine if the event trace information is in + determine if the event trace information is in little or big endian format. - [Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This + [Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This enables use of 32, 24, 16, or event 8-bit timers. - If the time source is 32-bits, the mask is - 0xFFFFFFFF. If the time source is 16-bits, the + If the time source is 32-bits, the mask is + 0xFFFFFFFF. If the time source is 16-bits, the mask is 0x0000FFFF. [Trace Base Address] 4 The base address for all trace pointer. Subtracting the pointer and this address will yield the proper @@ -143,7 +143,7 @@ [Trace Buffer Start Pointer] 4 Pointer to the start of the Trace Buffer Area [Trace Buffer End Pointer] 4 Pointer to the end of the Trace Buffer Area [Trace Buffer Current Pointer] 4 Pointer to the oldest entry in the Trace Buffer. - This entry will be overwritten on the next event and + This entry will be overwritten on the next event and incremented to the next event (wrapping to the top if the buffer end pointer is exceeded). [Reserved] 4 Reserved 4 bytes, should be 0xAAAAAAAA @@ -173,7 +173,7 @@ typedef struct TX_TRACE_HEADER_STRUCT } TX_TRACE_HEADER; -/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to +/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to the application's name for the object (defined during object creation in ThreadX). */ #ifndef TX_TRACE_OBJECT_REGISTRY_NAME @@ -181,7 +181,7 @@ typedef struct TX_TRACE_HEADER_STRUCT #endif -/* Define the object name types as well as the contents of any additional parameters that might be useful in +/* Define the object name types as well as the contents of any additional parameters that might be useful in trace analysis. */ #define TX_TRACE_OBJECT_TYPE_NOT_VALID ((UCHAR) 0) /* Object is not valid */ @@ -214,27 +214,27 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT Entry Size Description - [Thread Pointer] 4 This 4-byte field contains the pointer to the - ThreadX thread running that caused the event. + [Thread Pointer] 4 This 4-byte field contains the pointer to the + ThreadX thread running that caused the event. If this field is NULL, the entry hasn't been used yet. If this field is 0xFFFFFFFF, the event occurred - from within an ISR. If this entry is 0xF0F0F0F0, the + from within an ISR. If this entry is 0xF0F0F0F0, the event occurred during initialization. [Thread Priority or 4 This 4-byte field contains the current thread pointer for interrupt Current Thread events or the thread preemption-threshold/priority for thread events. Preemption-Threshold/ Priority] - [Event ID] 4 This 4-byte field contains the Event ID of the event. A value of + [Event ID] 4 This 4-byte field contains the Event ID of the event. A value of 0xFFFFFFFF indicates the event is invalid. All events are marked as invalid during initialization. [Time Stamp] 4 This 4-byte field contains the time stamp of the event. - [Information Field 1] 4 This 4-byte field contains the first 4-bytes of information + [Information Field 1] 4 This 4-byte field contains the first 4-bytes of information specific to the event. - [Information Field 2] 4 This 4-byte field contains the second 4-bytes of information + [Information Field 2] 4 This 4-byte field contains the second 4-bytes of information specific to the event. - [Information Field 3] 4 This 4-byte field contains the third 4-bytes of information + [Information Field 3] 4 This 4-byte field contains the third 4-bytes of information specific to the event. - [Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information + [Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information specific to the event. */ @@ -244,15 +244,15 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT /* Define ThreadX Trace Events, along with a brief description of the additional information fields, where I1 -> Information Field 1, I2 -> Information Field 2, etc. */ -/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are: - - ThreadX events: 1-199 +/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are: + + ThreadX events: 1-199 FileX events: 200-299 NetX events: 300-599 USBX events: 600-999 - - User-defined event numbers start at 4096 and continue through 65535, as defined by the constants - TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based + + User-defined event numbers start at 4096 and continue through 65535, as defined by the constants + TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based on these constants in case the user event number assignment is changed in future releases. */ /* Define the basic ThreadX thread scheduling events first. */ @@ -417,7 +417,7 @@ TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_end_ptr; TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_current_ptr; -/* Define the trace event enable bits, where each bit represents a type of event that can be enabled +/* Define the trace event enable bits, where each bit represents a type of event that can be enabled or disabled dynamically by the application. */ TRACE_DECLARE ULONG _tx_trace_event_enable_bits; @@ -429,9 +429,9 @@ TRACE_DECLARE ULONG _tx_trace_event_enable_bits; TRACE_DECLARE ULONG _tx_trace_simulated_time; -/* Define the function pointer used to call the application when the trace buffer wraps. If NULL, +/* Define the function pointer used to call the application when the trace buffer wraps. If NULL, the application has not registered a callback function. */ - + TRACE_DECLARE VOID (*_tx_trace_full_notify_function)(VOID *buffer); diff --git a/common/inc/tx_user_sample.h b/common/inc/tx_user_sample.h index 07ac0070..e22babf4 100644 --- a/common/inc/tx_user_sample.h +++ b/common/inc/tx_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_user.h PORTABLE C */ -/* 6.1.5 */ +/* 6.1.9 */ /* */ /* AUTHOR */ /* */ @@ -51,6 +51,13 @@ /* added option to remove */ /* FileX pointer, */ /* resulting in version 6.1.5 */ +/* 06-02-2021 Scott Larson Added options for multiple */ +/* block pool search & delay, */ +/* resulting in version 6.1.7 */ +/* 10-15-2021 Yuxin Zhou Modified comment(s), added */ +/* user-configurable symbol */ +/* TX_TIMER_TICKS_PER_SECOND */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ @@ -59,9 +66,9 @@ /* Define various build options for the ThreadX port. The application should either make changes - here by commenting or un-commenting the conditional compilation defined OR supply the defines - though the compiler's equivalent of the -D option. - + here by commenting or un-commenting the conditional compilation defined OR supply the defines + though the compiler's equivalent of the -D option. + For maximum speed, the following should be defined: TX_MAX_PRIORITIES 32 @@ -73,9 +80,9 @@ TX_REACTIVATE_INLINE TX_DISABLE_STACK_FILLING TX_INLINE_THREAD_RESUME_SUSPEND - + For minimum size, the following should be defined: - + TX_MAX_PRIORITIES 32 TX_DISABLE_PREEMPTION_THRESHOLD TX_DISABLE_REDUNDANT_CLEARING @@ -83,12 +90,12 @@ TX_NO_FILEX_POINTER TX_NOT_INTERRUPTABLE TX_TIMER_PROCESS_IN_ISR - + Of course, many of these defines reduce functionality and/or change the behavior of the system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR results in faster and smaller code, however, it increases the amount of processing in the ISR. In addition, some services that are available in timers are not available from ISRs and will - therefore return an error if this option is used. This may or may not be desirable for a + therefore return an error if this option is used. This may or may not be desirable for a given application. */ @@ -103,19 +110,28 @@ #define TX_TIMER_THREAD_PRIORITY ???? */ +/* Define the common timer tick reference for use by other middleware components. The default + value is 10ms (i.e. 100 ticks, defined in tx_api.h), but may be replaced by a port-specific + version in tx_port.h or here. + Note: the actual hardware timer value may need to be changed (usually in tx_initialize_low_level). */ + +/* +#define TX_TIMER_TICKS_PER_SECOND ((ULONG) 100) +*/ + /* Determine if there is a FileX pointer in the thread control block. - By default, the pointer is there for legacy/backwards compatibility. + By default, the pointer is there for legacy/backwards compatibility. The pointer must also be there for applications using FileX. - Define this to save space in the thread control block. + Define this to save space in the thread control block. */ /* #define TX_NO_FILEX_POINTER */ -/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls - should be processed within the a system timer thread or directly in the timer ISR. - By default, the timer thread is used. When the following is defined, the timer expiration +/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls + should be processed within the a system timer thread or directly in the timer ISR. + By default, the timer thread is used. When the following is defined, the timer expiration processing is done directly from the timer ISR, thereby eliminating the timer thread control block, stack, and context switching to activate it. */ @@ -140,7 +156,7 @@ #define TX_DISABLE_STACK_FILLING */ -/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is +/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is disabled. When the following is defined, ThreadX thread stack checking is enabled. If stack checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING define is negated, thereby forcing the stack fill which is necessary for the stack checking @@ -150,7 +166,7 @@ #define TX_ENABLE_STACK_CHECKING */ -/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is +/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is enabled. If the application does not use preemption-threshold, it may be disabled to reduce code size and improve performance. */ @@ -158,7 +174,7 @@ #define TX_DISABLE_PREEMPTION_THRESHOLD */ -/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears +/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary clearing of ThreadX global variables. */ @@ -166,9 +182,9 @@ #define TX_DISABLE_REDUNDANT_CLEARING */ -/* Determine if no timer processing is required. This option will help eliminate the timer - processing when not needed. The user will also have to comment out the call to - tx_timer_interrupt, which is typically made from assembly language in +/* Determine if no timer processing is required. This option will help eliminate the timer + processing when not needed. The user will also have to comment out the call to + tx_timer_interrupt, which is typically made from assembly language in tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR must also be used and tx_timer_initialize must be removed from ThreadX library. */ @@ -188,8 +204,8 @@ */ -/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal - code in-line. This results in a larger image, but improves the performance of the thread +/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal + code in-line. This results in a larger image, but improves the performance of the thread resume and suspend services. */ /* @@ -197,7 +213,7 @@ */ -/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code +/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code size and less processing overhead, but increases the interrupt lockout time. */ /* @@ -205,8 +221,8 @@ */ -/* Determine if the trace event logging code should be enabled. This causes slight increases in - code size and overhead, but provides the ability to generate system trace information which +/* Determine if the trace event logging code should be enabled. This causes slight increases in + code size and overhead, but provides the ability to generate system trace information which is available for viewing in TraceX. */ /* @@ -270,5 +286,17 @@ #define TX_TIMER_ENABLE_PERFORMANCE_INFO */ +/* Override options for byte pool searches of multiple blocks. */ + +/* +#define TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH 20 +*/ + +/* Override options for byte pool search delay to avoid thrashing. */ + +/* +#define TX_BYTE_POOL_DELAY_VALUE 3 +*/ + #endif diff --git a/common/src/tx_block_allocate.c b/common/src/tx_block_allocate.c index d5731c77..ad00c34a 100644 --- a/common/src/tx_block_allocate.c +++ b/common/src/tx_block_allocate.c @@ -170,7 +170,7 @@ ULONG lower_tbu; /* Save the pool's address in the block for when it is released! */ temp_ptr = TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(pool_ptr); *next_block_ptr = temp_ptr; - + #ifdef TX_ENABLE_EVENT_TRACE /* Check that the event time stamp is unchanged. A different @@ -182,7 +182,7 @@ ULONG lower_tbu; /* Is the time stamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, update the entry with the address. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*block_ptr); @@ -200,7 +200,7 @@ ULONG lower_tbu; /* Set status to success. */ status = TX_SUCCESS; - + /* Restore interrupts. */ TX_RESTORE } @@ -229,7 +229,7 @@ ULONG lower_tbu; { /* Prepare for suspension of this thread. */ - + #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO /* Increment the total suspensions counter. */ @@ -261,7 +261,7 @@ ULONG lower_tbu; /* Pickup the number of suspended threads. */ suspended_count = (pool_ptr -> tx_block_pool_suspended_count); - + /* Increment the number of suspended threads. */ (pool_ptr -> tx_block_pool_suspended_count)++; @@ -322,11 +322,11 @@ ULONG lower_tbu; allocate event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the time-stamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, update the entry with the address. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*block_ptr); diff --git a/common/src/tx_block_pool_cleanup.c b/common/src/tx_block_pool_cleanup.c index 4feacb8f..12b4dcbd 100644 --- a/common/src/tx_block_pool_cleanup.c +++ b/common/src/tx_block_pool_cleanup.c @@ -87,7 +87,7 @@ UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; - + #ifndef TX_NOT_INTERRUPTABLE /* Disable interrupts to remove the suspended thread from the block pool. */ @@ -96,7 +96,7 @@ TX_THREAD *previous_thread; /* Determine if the cleanup is still required. */ if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_block_pool_cleanup)) { - + /* Check for valid suspension sequence. */ if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence) { @@ -107,7 +107,7 @@ TX_THREAD *previous_thread; /* Check for a NULL byte pool pointer. */ if (pool_ptr != TX_NULL) { - + /* Check for valid pool ID. */ if (pool_ptr -> tx_block_pool_id == TX_BLOCK_POOL_ID) { @@ -133,13 +133,13 @@ TX_THREAD *previous_thread; suspended_count = pool_ptr -> tx_block_pool_suspended_count; /* Remove the suspended thread from the list. */ - + /* See if this is the only suspended thread on the list. */ if (suspended_count == TX_NO_SUSPENSIONS) { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ pool_ptr -> tx_block_pool_suspension_list = TX_NULL; } @@ -157,7 +157,7 @@ TX_THREAD *previous_thread; /* Determine if we need to update the head pointer. */ if (pool_ptr -> tx_block_pool_suspension_list == thread_ptr) { - + /* Update the list head pointer. */ pool_ptr -> tx_block_pool_suspension_list = next_thread; } @@ -168,7 +168,7 @@ TX_THREAD *previous_thread; if (thread_ptr -> tx_thread_state == TX_BLOCK_MEMORY) { - /* Timeout condition and the thread still suspended on the block pool. + /* Timeout condition and the thread still suspended on the block pool. Setup return error status and resume the thread. */ #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO diff --git a/common/src/tx_block_pool_create.c b/common/src/tx_block_pool_create.c index be222888..2b9cdbcf 100644 --- a/common/src/tx_block_pool_create.c +++ b/common/src/tx_block_pool_create.c @@ -97,7 +97,7 @@ TX_BLOCK_POOL *previous_pool; an ALIGN_TYPE (typically this is a 32-bit ULONG). This helps guarantee proper alignment. */ block_size = (((block_size + (sizeof(ALIGN_TYPE))) - ((ALIGN_TYPE) 1))/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE)); - /* Round the pool size down to something that is evenly divisible by + /* Round the pool size down to something that is evenly divisible by an ALIGN_TYPE (typically this is a 32-bit ULONG). */ pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE)); @@ -106,7 +106,7 @@ TX_BLOCK_POOL *previous_pool; pool_ptr -> tx_block_pool_start = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); pool_ptr -> tx_block_pool_size = pool_size; pool_ptr -> tx_block_pool_block_size = (UINT) block_size; - + /* Calculate the total number of blocks. */ total_blocks = pool_size/(block_size + (sizeof(UCHAR *))); @@ -145,7 +145,7 @@ TX_BLOCK_POOL *previous_pool; /* Set the last block's forward pointer to NULL. */ block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr); *block_link_ptr = TX_NULL; - + /* Setup the starting pool address. */ pool_ptr -> tx_block_pool_available_list = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); @@ -180,7 +180,7 @@ TX_BLOCK_POOL *previous_pool; pool_ptr -> tx_block_pool_created_previous = previous_pool; pool_ptr -> tx_block_pool_created_next = next_pool; } - + /* Increment the created count. */ _tx_block_pool_created_count++; @@ -208,7 +208,7 @@ TX_BLOCK_POOL *previous_pool; /* Not enough memory for one block, return appropriate error. */ status = TX_SIZE_ERROR; } - + /* Return completion status. */ return(status); } diff --git a/common/src/tx_block_pool_delete.c b/common/src/tx_block_pool_delete.c index 72a080f0..e6d7491c 100644 --- a/common/src/tx_block_pool_delete.c +++ b/common/src/tx_block_pool_delete.c @@ -126,7 +126,7 @@ TX_BLOCK_POOL *previous_pool; /* See if we have to update the created list head pointer. */ if (_tx_block_pool_created_ptr == pool_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_block_pool_created_ptr = next_pool; } @@ -148,14 +148,14 @@ TX_BLOCK_POOL *previous_pool; on this block pool. */ while (suspended_count != TX_NO_SUSPENSIONS) { - + /* Decrement the suspension count. */ suspended_count--; - + /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; diff --git a/common/src/tx_block_pool_info_get.c b/common/src/tx_block_pool_info_get.c index ca733500..4837f45b 100644 --- a/common/src/tx_block_pool_info_get.c +++ b/common/src/tx_block_pool_info_get.c @@ -77,8 +77,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, - ULONG *total_blocks, TX_THREAD **first_suspended, +UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, + ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool) { @@ -100,42 +100,42 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the block pool. */ if (name != TX_NULL) { - + *name = pool_ptr -> tx_block_pool_name; } /* Retrieve the number of available blocks in the block pool. */ if (available_blocks != TX_NULL) { - + *available_blocks = (ULONG) pool_ptr -> tx_block_pool_available; } /* Retrieve the total number of blocks in the block pool. */ if (total_blocks != TX_NULL) { - + *total_blocks = (ULONG) pool_ptr -> tx_block_pool_total; } /* Retrieve the first thread suspended on this block pool. */ if (first_suspended != TX_NULL) { - + *first_suspended = pool_ptr -> tx_block_pool_suspension_list; } /* Retrieve the number of threads suspended on this block pool. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) pool_ptr -> tx_block_pool_suspended_count; } /* Retrieve the pointer to the next block pool created. */ if (next_pool != TX_NULL) { - + *next_pool = pool_ptr -> tx_block_pool_created_next; } diff --git a/common/src/tx_block_pool_performance_info_get.c b/common/src/tx_block_pool_performance_info_get.c index cedbbadd..71112031 100644 --- a/common/src/tx_block_pool_performance_info_get.c +++ b/common/src/tx_block_pool_performance_info_get.c @@ -93,7 +93,7 @@ UINT status; /* Determine if this is a legal request. */ if (pool_ptr == TX_NULL) { - + /* Block pool pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -101,13 +101,13 @@ UINT status; /* Determine if the pool ID is invalid. */ else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID) { - + /* Block pool pointer is illegal, return error. */ status = TX_PTR_ERROR; } else { - + /* Disable interrupts. */ TX_DISABLE @@ -123,28 +123,28 @@ UINT status; /* Retrieve the number of allocations from this block pool. */ if (allocates != TX_NULL) { - + *allocates = pool_ptr -> tx_block_pool_performance_allocate_count; } /* Retrieve the number of blocks released to this block pool. */ if (releases != TX_NULL) { - + *releases = pool_ptr -> tx_block_pool_performance_release_count; } /* Retrieve the number of thread suspensions on this block pool. */ if (suspensions != TX_NULL) { - + *suspensions = pool_ptr -> tx_block_pool_performance_suspension_count; } /* Retrieve the number of thread timeouts on this block pool. */ if (timeouts != TX_NULL) { - + *timeouts = pool_ptr -> tx_block_pool_performance_timeout_count; } @@ -157,7 +157,7 @@ UINT status; #else UINT status; - + /* Access input arguments just for the sake of lint, MISRA, etc. */ if (pool_ptr != TX_NULL) { @@ -191,7 +191,7 @@ UINT status; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_block_pool_performance_system_info_get.c b/common/src/tx_block_pool_performance_system_info_get.c index eaf3f749..4842bc93 100644 --- a/common/src/tx_block_pool_performance_system_info_get.c +++ b/common/src/tx_block_pool_performance_system_info_get.c @@ -100,28 +100,28 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of block allocations. */ if (allocates != TX_NULL) { - + *allocates = _tx_block_pool_performance_allocate_count; } /* Retrieve the total number of blocks released. */ if (releases != TX_NULL) { - + *releases = _tx_block_pool_performance_release_count; } /* Retrieve the total number of block pool thread suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_block_pool_performance_suspension_count; } /* Retrieve the total number of block pool thread timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_block_pool_performance_timeout_count; } @@ -139,35 +139,35 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (allocates != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (releases != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } - + /* Return completion status. */ return(status); #endif diff --git a/common/src/tx_block_pool_prioritize.c b/common/src/tx_block_pool_prioritize.c index 89b7a45b..551b2019 100644 --- a/common/src/tx_block_pool_prioritize.c +++ b/common/src/tx_block_pool_prioritize.c @@ -130,7 +130,7 @@ UINT list_changed; /* Remember the suspension count and head pointer. */ head_ptr = pool_ptr -> tx_block_pool_suspension_list; - + /* Default the highest priority thread to the thread at the front of the list. */ priority_thread_ptr = head_ptr; @@ -142,7 +142,7 @@ UINT list_changed; /* Set the list changed flag to false. */ list_changed = TX_FALSE; - + /* Search through the list to find the highest priority thread. */ do { @@ -160,33 +160,33 @@ UINT list_changed; /* Disable interrupts again. */ TX_DISABLE - - /* Determine if any changes to the list have occurred while + + /* Determine if any changes to the list have occurred while interrupts were enabled. */ - + /* Is the list head the same? */ if (head_ptr != pool_ptr -> tx_block_pool_suspension_list) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } else { - + /* Is the suspended count the same? */ if (suspended_count != pool_ptr -> tx_block_pool_suspended_count) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } } - + /* Determine if the list has changed. */ if (list_changed == TX_FALSE) { - + /* Move the thread pointer to the next thread. */ thread_ptr = thread_ptr -> tx_thread_suspended_next; } @@ -202,7 +202,7 @@ UINT list_changed; /* Setup search pointer. */ thread_ptr = priority_thread_ptr -> tx_thread_suspended_next; - + /* Reset the list changed flag. */ list_changed = TX_FALSE; } @@ -212,12 +212,12 @@ UINT list_changed; /* Release preemption. */ _tx_thread_preempt_disable--; - /* Now determine if the highest priority thread is at the front + /* Now determine if the highest priority thread is at the front of the list. */ if (priority_thread_ptr != head_ptr) { - /* No, we need to move the highest priority suspended thread to the + /* No, we need to move the highest priority suspended thread to the front of the list. */ /* First, remove the highest priority thread by updating the diff --git a/common/src/tx_block_release.c b/common/src/tx_block_release.c index 59f7b3ad..6ac34664 100644 --- a/common/src/tx_block_release.c +++ b/common/src/tx_block_release.c @@ -90,7 +90,7 @@ TX_THREAD *previous_thread; /* Disable interrupts to put this block back in the pool. */ TX_DISABLE - /* Pickup the pool pointer which is just previous to the starting + /* Pickup the pool pointer which is just previous to the starting address of the block that the caller sees. */ work_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(block_ptr); work_ptr = TX_UCHAR_POINTER_SUB(work_ptr, (sizeof(UCHAR *))); @@ -121,7 +121,7 @@ TX_THREAD *previous_thread; /* Decrement the number of threads suspended. */ (pool_ptr -> tx_block_pool_suspended_count)--; - + /* Pickup the suspended count. */ suspended_count = (pool_ptr -> tx_block_pool_suspended_count); @@ -148,7 +148,7 @@ TX_THREAD *previous_thread; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; } - + /* Prepare for resumption of the first thread. */ /* Clear cleanup routine to avoid timeout. */ diff --git a/common/src/tx_byte_allocate.c b/common/src/tx_byte_allocate.c index b4f173b7..be7e28c4 100644 --- a/common/src/tx_byte_allocate.c +++ b/common/src/tx_byte_allocate.c @@ -181,17 +181,17 @@ ULONG lower_tbu; /* Determine if we are finished. */ if (work_ptr != TX_NULL) { - + /* Yes, we have found a block the search is finished. */ finished = TX_TRUE; } else { - + /* No block was found, does this thread still own the pool? */ if (pool_ptr -> tx_byte_pool_owner == thread_ptr) { - + /* Yes, then we have looked through the entire pool and haven't found the memory. */ finished = TX_TRUE; } @@ -217,7 +217,7 @@ ULONG lower_tbu; /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, update the entry with the address. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*memory_ptr); @@ -242,7 +242,7 @@ ULONG lower_tbu; /* Restore interrupts. */ TX_RESTORE - + /* Set the status to success. */ status = TX_SUCCESS; } @@ -304,7 +304,7 @@ ULONG lower_tbu; /* Increment the suspension count. */ (pool_ptr -> tx_byte_pool_suspended_count)++; - + /* Setup suspension list. */ if (suspended_count == TX_NO_SUSPENSIONS) { @@ -366,7 +366,7 @@ ULONG lower_tbu; /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, update the entry with the address. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*memory_ptr); @@ -396,7 +396,7 @@ ULONG lower_tbu; } else { - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_byte_pool_cleanup.c b/common/src/tx_byte_pool_cleanup.c index 5047ca57..e8cd1a0e 100644 --- a/common/src/tx_byte_pool_cleanup.c +++ b/common/src/tx_byte_pool_cleanup.c @@ -87,7 +87,7 @@ UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; - + #ifndef TX_NOT_INTERRUPTABLE /* Disable interrupts to remove the suspended thread from the byte pool. */ @@ -96,7 +96,7 @@ TX_THREAD *previous_thread; /* Determine if the cleanup is still required. */ if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_byte_pool_cleanup)) { - + /* Check for valid suspension sequence. */ if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence) { @@ -107,7 +107,7 @@ TX_THREAD *previous_thread; /* Check for a NULL byte pool pointer. */ if (pool_ptr != TX_NULL) { - + /* Check for valid pool ID. */ if (pool_ptr -> tx_byte_pool_id == TX_BYTE_POOL_ID) { @@ -126,18 +126,18 @@ TX_THREAD *previous_thread; /* Decrement the suspension count. */ pool_ptr -> tx_byte_pool_suspended_count--; - + /* Pickup the suspended count. */ suspended_count = pool_ptr -> tx_byte_pool_suspended_count; /* Remove the suspended thread from the list. */ - + /* See if this is the only suspended thread on the list. */ if (suspended_count == TX_NO_SUSPENSIONS) { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ pool_ptr -> tx_byte_pool_suspension_list = TX_NULL; } @@ -155,7 +155,7 @@ TX_THREAD *previous_thread; /* Determine if we need to update the head pointer. */ if (pool_ptr -> tx_byte_pool_suspension_list == thread_ptr) { - + /* Update the list head pointer. */ pool_ptr -> tx_byte_pool_suspension_list = next_thread; } @@ -166,7 +166,7 @@ TX_THREAD *previous_thread; if (thread_ptr -> tx_thread_state == TX_BYTE_MEMORY) { - /* Timeout condition and the thread still suspended on the byte pool. + /* Timeout condition and the thread still suspended on the byte pool. Setup return error status and resume the thread. */ #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO diff --git a/common/src/tx_byte_pool_create.c b/common/src/tx_byte_pool_create.c index 2225e61b..ffd35e54 100644 --- a/common/src/tx_byte_pool_create.c +++ b/common/src/tx_byte_pool_create.c @@ -89,7 +89,7 @@ ALIGN_TYPE *free_ptr; /* Initialize the byte pool control block to all zeros. */ TX_MEMSET(pool_ptr, 0, (sizeof(TX_BYTE_POOL))); - /* Round the pool size down to something that is evenly divisible by + /* Round the pool size down to something that is evenly divisible by an ULONG. */ pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE)); @@ -104,17 +104,17 @@ ALIGN_TYPE *free_ptr; pool_ptr -> tx_byte_pool_list = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); pool_ptr -> tx_byte_pool_search = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); - /* Initially, the pool will have two blocks. One large block at the + /* Initially, the pool will have two blocks. One large block at the beginning that is available and a small allocated block at the end of the pool that is there just for the algorithm. Be sure to count the available block's header in the available bytes count. */ pool_ptr -> tx_byte_pool_available = pool_size - ((sizeof(VOID *)) + (sizeof(ALIGN_TYPE))); pool_ptr -> tx_byte_pool_fragments = ((UINT) 2); - + /* Each block contains a "next" pointer that points to the next block in the pool followed by a ALIGN_TYPE field that contains either the constant TX_BYTE_BLOCK_FREE (if the block is free) or a pointer to the owning pool (if the block is allocated). */ - + /* Calculate the end of the pool's memory area. */ block_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); block_ptr = TX_UCHAR_POINTER_ADD(block_ptr, pool_size); @@ -177,7 +177,7 @@ ALIGN_TYPE *free_ptr; /* Increment the number of created byte pools. */ _tx_byte_pool_created_count++; - + /* Optional byte pool create extended processing. */ TX_BYTE_POOL_CREATE_EXTENSION(pool_ptr) diff --git a/common/src/tx_byte_pool_delete.c b/common/src/tx_byte_pool_delete.c index a8de3773..1d8a3fa7 100644 --- a/common/src/tx_byte_pool_delete.c +++ b/common/src/tx_byte_pool_delete.c @@ -110,7 +110,7 @@ TX_BYTE_POOL *previous_pool; /* Decrement the number of byte pools created. */ _tx_byte_pool_created_count--; - + /* See if the byte pool is the only one on the list. */ if (_tx_byte_pool_created_count == TX_EMPTY) { @@ -130,7 +130,7 @@ TX_BYTE_POOL *previous_pool; /* See if we have to update the created list head pointer. */ if (_tx_byte_pool_created_ptr == pool_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_byte_pool_created_ptr = next_pool; } @@ -144,7 +144,7 @@ TX_BYTE_POOL *previous_pool; pool_ptr -> tx_byte_pool_suspension_list = TX_NULL; suspended_count = pool_ptr -> tx_byte_pool_suspended_count; pool_ptr -> tx_byte_pool_suspended_count = TX_NO_SUSPENSIONS; - + /* Restore interrupts. */ TX_RESTORE @@ -152,14 +152,14 @@ TX_BYTE_POOL *previous_pool; on this byte pool. */ while (suspended_count != TX_NO_SUSPENSIONS) { - + /* Decrement the suspension count. */ suspended_count--; - + /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; diff --git a/common/src/tx_byte_pool_info_get.c b/common/src/tx_byte_pool_info_get.c index 296adf72..b13e8e31 100644 --- a/common/src/tx_byte_pool_info_get.c +++ b/common/src/tx_byte_pool_info_get.c @@ -77,8 +77,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, - ULONG *fragments, TX_THREAD **first_suspended, +UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, + ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool) { @@ -100,42 +100,42 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the byte pool. */ if (name != TX_NULL) { - + *name = pool_ptr -> tx_byte_pool_name; } /* Retrieve the number of available bytes in the byte pool. */ if (available_bytes != TX_NULL) { - + *available_bytes = pool_ptr -> tx_byte_pool_available; } /* Retrieve the total number of bytes in the byte pool. */ if (fragments != TX_NULL) { - + *fragments = (ULONG) pool_ptr -> tx_byte_pool_fragments; } /* Retrieve the first thread suspended on this byte pool. */ if (first_suspended != TX_NULL) { - + *first_suspended = pool_ptr -> tx_byte_pool_suspension_list; } /* Retrieve the number of threads suspended on this byte pool. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) pool_ptr -> tx_byte_pool_suspended_count; } /* Retrieve the pointer to the next byte pool created. */ if (next_pool != TX_NULL) { - + *next_pool = pool_ptr -> tx_byte_pool_created_next; } diff --git a/common/src/tx_byte_pool_performance_info_get.c b/common/src/tx_byte_pool_performance_info_get.c index 69968769..c3f685fd 100644 --- a/common/src/tx_byte_pool_performance_info_get.c +++ b/common/src/tx_byte_pool_performance_info_get.c @@ -102,15 +102,15 @@ UINT status; /* Determine if this is a legal request. */ if (pool_ptr == TX_NULL) { - + /* Byte pool pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the pool ID is invalid. */ else if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID) { - + /* Byte pool pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -132,7 +132,7 @@ UINT status; /* Retrieve the number of allocates on this byte pool. */ if (allocates != TX_NULL) { - + *allocates = pool_ptr -> tx_byte_pool_performance_allocate_count; } @@ -146,35 +146,35 @@ UINT status; /* Retrieve the number of fragments searched in this byte pool. */ if (fragments_searched != TX_NULL) { - + *fragments_searched = pool_ptr -> tx_byte_pool_performance_search_count; } - + /* Retrieve the number of fragments merged on this byte pool. */ if (merges != TX_NULL) { *merges = pool_ptr -> tx_byte_pool_performance_merge_count; } - + /* Retrieve the number of fragment splits on this byte pool. */ if (splits != TX_NULL) { - + *splits = pool_ptr -> tx_byte_pool_performance_split_count; } /* Retrieve the number of suspensions on this byte pool. */ if (suspensions != TX_NULL) { - + *suspensions = pool_ptr -> tx_byte_pool_performance_suspension_count; } /* Retrieve the number of timeouts on this byte pool. */ if (timeouts != TX_NULL) { - + *timeouts = pool_ptr -> tx_byte_pool_performance_timeout_count; } @@ -184,7 +184,7 @@ UINT status; /* Return completion status. */ status = TX_SUCCESS; } - + /* Return completion status. */ return(status); #else @@ -195,55 +195,55 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (pool_ptr != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (allocates != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (releases != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (fragments_searched != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (merges != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (splits != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_byte_pool_performance_system_info_get.c b/common/src/tx_byte_pool_performance_system_info_get.c index d873e60a..4d804952 100644 --- a/common/src/tx_byte_pool_performance_system_info_get.c +++ b/common/src/tx_byte_pool_performance_system_info_get.c @@ -109,58 +109,58 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of byte pool allocates. */ if (allocates != TX_NULL) { - + *allocates = _tx_byte_pool_performance_allocate_count; } /* Retrieve the total number of byte pool releases. */ if (releases != TX_NULL) { - + *releases = _tx_byte_pool_performance_release_count; } /* Retrieve the total number of byte pool fragments searched. */ if (fragments_searched != TX_NULL) { - + *fragments_searched = _tx_byte_pool_performance_search_count; } /* Retrieve the total number of byte pool fragments merged. */ if (merges != TX_NULL) { - + *merges = _tx_byte_pool_performance_merge_count; } /* Retrieve the total number of byte pool fragment splits. */ if (splits != TX_NULL) { - + *splits = _tx_byte_pool_performance_split_count; } /* Retrieve the total number of byte pool suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_byte_pool_performance_suspension_count; } - + /* Retrieve the total number of byte pool timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_byte_pool_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -215,7 +215,7 @@ UINT status; /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } - + /* Return completion status. */ return(status); #endif diff --git a/common/src/tx_byte_pool_prioritize.c b/common/src/tx_byte_pool_prioritize.c index 0e8d2868..30f273e8 100644 --- a/common/src/tx_byte_pool_prioritize.c +++ b/common/src/tx_byte_pool_prioritize.c @@ -161,19 +161,19 @@ UINT list_changed; /* Disable interrupts again. */ TX_DISABLE - /* Determine if any changes to the list have occurred while + /* Determine if any changes to the list have occurred while interrupts were enabled. */ - + /* Is the list head the same? */ if (head_ptr != pool_ptr -> tx_byte_pool_suspension_list) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } else { - + /* Is the suspended count the same? */ if (suspended_count != pool_ptr -> tx_byte_pool_suspended_count) { @@ -212,12 +212,12 @@ UINT list_changed; /* Release preemption. */ _tx_thread_preempt_disable--; - /* Now determine if the highest priority thread is at the front + /* Now determine if the highest priority thread is at the front of the list. */ if (priority_thread_ptr != head_ptr) { - /* No, we need to move the highest priority suspended thread to the + /* No, we need to move the highest priority suspended thread to the front of the list. */ /* First, remove the highest priority thread by updating the diff --git a/common/src/tx_byte_release.c b/common/src/tx_byte_release.c index a60d4f49..2d1dc7bb 100644 --- a/common/src/tx_byte_release.c +++ b/common/src/tx_byte_release.c @@ -98,7 +98,7 @@ UCHAR **suspend_info_ptr; /* Default to successful status. */ status = TX_SUCCESS; - + /* Set the pool pointer to NULL. */ pool_ptr = TX_NULL; @@ -109,7 +109,7 @@ UCHAR **suspend_info_ptr; work_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(memory_ptr); if (work_ptr != TX_NULL) { - + /* Back off the memory pointer to pickup its header. */ work_ptr = TX_UCHAR_POINTER_SUB(work_ptr, ((sizeof(UCHAR *)) + (sizeof(ALIGN_TYPE)))); @@ -127,7 +127,7 @@ UCHAR **suspend_info_ptr; /* See if we have a valid pool pointer. */ if (pool_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_PTR_ERROR; } @@ -137,10 +137,10 @@ UCHAR **suspend_info_ptr; /* See if we have a valid pool. */ if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID) { - + /* Return pointer error. */ status = TX_PTR_ERROR; - + /* Reset the pool pointer is NULL. */ pool_ptr = TX_NULL; } @@ -163,13 +163,13 @@ UCHAR **suspend_info_ptr; /* Determine if the pointer is valid. */ if (pool_ptr == TX_NULL) { - + /* Restore interrupts. */ TX_RESTORE } else { - + /* At this point, we know that the pointer is valid. */ /* Pickup thread pointer. */ @@ -201,7 +201,7 @@ UCHAR **suspend_info_ptr; /* Update the number of available bytes in the pool. */ block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr); next_block_ptr = *block_link_ptr; - pool_ptr -> tx_byte_pool_available = + pool_ptr -> tx_byte_pool_available = pool_ptr -> tx_byte_pool_available + TX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr); /* Determine if the free block is prior to current search pointer. */ @@ -215,8 +215,8 @@ UCHAR **suspend_info_ptr; /* Determine if there are threads suspended on this byte pool. */ if (pool_ptr -> tx_byte_pool_suspended_count != TX_NO_SUSPENSIONS) { - - /* Now examine the suspension list to find threads waiting for + + /* Now examine the suspension list to find threads waiting for memory. Maybe it is now available! */ while (pool_ptr -> tx_byte_pool_suspended_count != TX_NO_SUSPENSIONS) { @@ -245,7 +245,7 @@ UCHAR **suspend_info_ptr; /* If there is not enough memory, break this loop! */ if (work_ptr == TX_NULL) { - + /* Break out of the loop. */ break; } @@ -257,7 +257,7 @@ UCHAR **suspend_info_ptr; /* Also, makes sure the memory size is the same. */ if (susp_thread_ptr -> tx_thread_suspend_info == memory_size) { - + /* Remove the suspended thread from the list. */ /* Decrement the number of threads suspended. */ @@ -302,7 +302,7 @@ UCHAR **suspend_info_ptr; /* Clear the memory pointer to indicate that it was given to the suspended thread. */ work_ptr = TX_NULL; - + /* Put return status into the thread control block. */ susp_thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; @@ -328,11 +328,11 @@ UCHAR **suspend_info_ptr; TX_DISABLE } } - + /* Determine if the memory was given to the suspended thread. */ if (work_ptr != TX_NULL) { - + /* No, it wasn't given to the suspended thread. */ /* Put the memory back on the available list since this thread is no longer @@ -345,7 +345,7 @@ UCHAR **suspend_info_ptr; /* Update the number of available bytes in the pool. */ block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr); next_block_ptr = *block_link_ptr; - pool_ptr -> tx_byte_pool_available = + pool_ptr -> tx_byte_pool_available = pool_ptr -> tx_byte_pool_available + TX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr); /* Determine if the current pointer is before the search pointer. */ @@ -357,7 +357,7 @@ UCHAR **suspend_info_ptr; } } } - + /* Restore interrupts. */ TX_RESTORE @@ -366,7 +366,7 @@ UCHAR **suspend_info_ptr; } else { - + /* No, threads suspended, restore interrupts. */ TX_RESTORE } diff --git a/common/src/tx_event_flags_cleanup.c b/common/src/tx_event_flags_cleanup.c index df71e741..3f170976 100644 --- a/common/src/tx_event_flags_cleanup.c +++ b/common/src/tx_event_flags_cleanup.c @@ -104,11 +104,11 @@ TX_THREAD *previous_thread; /* Setup pointer to event flags control block. */ group_ptr = TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block); - + /* Check for a NULL event flags control block pointer. */ if (group_ptr != TX_NULL) { - + /* Is the group pointer ID valid? */ if (group_ptr -> tx_event_flags_group_id == TX_EVENT_FLAGS_ID) { @@ -133,9 +133,9 @@ TX_THREAD *previous_thread; /* Pickup the suspension head. */ suspension_head = group_ptr -> tx_event_flags_group_suspension_list; - /* Determine if the cleanup is being done while a set operation was interrupted. If the + /* Determine if the cleanup is being done while a set operation was interrupted. If the suspended count is non-zero and the suspension head is NULL, the list is being processed - and cannot be touched from here. The suspension list removal will instead take place + and cannot be touched from here. The suspension list removal will instead take place inside the event flag set code. */ if (suspension_head != TX_NULL) { @@ -144,7 +144,7 @@ TX_THREAD *previous_thread; /* Decrement the local suspension count. */ suspended_count--; - + /* Store the updated suspended count. */ group_ptr -> tx_event_flags_group_suspended_count = suspended_count; @@ -153,7 +153,7 @@ TX_THREAD *previous_thread; { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ group_ptr -> tx_event_flags_group_suspension_list = TX_NULL; } @@ -161,17 +161,17 @@ TX_THREAD *previous_thread; { /* At least one more thread is on the same suspension list. */ - + /* Update the links of the adjacent threads. */ next_thread = thread_ptr -> tx_thread_suspended_next; previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - + /* Determine if we need to update the head pointer. */ if (suspension_head == thread_ptr) { - + /* Update the list head pointer. */ group_ptr -> tx_event_flags_group_suspension_list = next_thread; } @@ -179,7 +179,7 @@ TX_THREAD *previous_thread; } else { - + /* In this case, the search pointer in an interrupted event flag set must be reset. */ group_ptr -> tx_event_flags_group_reset_search = TX_TRUE; } @@ -189,7 +189,7 @@ TX_THREAD *previous_thread; if (thread_ptr -> tx_thread_state == TX_EVENT_FLAG) { - /* Timeout condition and the thread still suspended on the event flags group. + /* Timeout condition and the thread still suspended on the event flags group. Setup return error status and resume the thread. */ #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO @@ -216,8 +216,8 @@ TX_THREAD *previous_thread; /* Restore interrupts. */ TX_RESTORE - /* Resume the thread! Check for preemption even though we are executing - from the system timer thread right now which normally executes at the + /* Resume the thread! Check for preemption even though we are executing + from the system timer thread right now which normally executes at the highest priority. */ _tx_thread_system_resume(thread_ptr); diff --git a/common/src/tx_event_flags_create.c b/common/src/tx_event_flags_create.c index 13e2e69a..807894f5 100644 --- a/common/src/tx_event_flags_create.c +++ b/common/src/tx_event_flags_create.c @@ -86,7 +86,7 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* Setup the basic event flags group fields. */ group_ptr -> tx_event_flags_group_name = name_ptr; - + /* Disable interrupts to put the event flags group on the created list. */ TX_DISABLE @@ -121,7 +121,7 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* Increment the number of created event flag groups. */ _tx_event_flags_created_count++; - + /* Optional event flag group create extended processing. */ TX_EVENT_FLAGS_GROUP_CREATE_EXTENSION(group_ptr) diff --git a/common/src/tx_event_flags_delete.c b/common/src/tx_event_flags_delete.c index b384d4bb..f384f126 100644 --- a/common/src/tx_event_flags_delete.c +++ b/common/src/tx_event_flags_delete.c @@ -106,7 +106,7 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* Decrement the number of created event flag groups. */ _tx_event_flags_created_count--; - + /* See if this group is the only one on the list. */ if (_tx_event_flags_created_count == TX_EMPTY) { @@ -126,7 +126,7 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* See if we have to update the created list head pointer. */ if (_tx_event_flags_created_ptr == group_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_event_flags_created_ptr = next_group; } @@ -144,18 +144,18 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* Restore interrupts. */ TX_RESTORE - /* Walk through the event flag suspension list to resume any and all threads + /* Walk through the event flag suspension list to resume any and all threads suspended on this group. */ while (suspended_count != TX_NO_SUSPENSIONS) { - + /* Decrement the number of suspended threads. */ suspended_count--; - + /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; diff --git a/common/src/tx_event_flags_get.c b/common/src/tx_event_flags_get.c index 33b5c344..1e79a4cd 100644 --- a/common/src/tx_event_flags_get.c +++ b/common/src/tx_event_flags_get.c @@ -130,16 +130,16 @@ UINT interrupted_set_request; /* Check for AND condition. All flags must be present to satisfy request. */ if (and_request == TX_AND) { - + /* AND request is present. */ - + /* Calculate the flags present. */ flags_satisfied = (current_flags & requested_flags); - + /* Determine if they satisfy the AND request. */ if (flags_satisfied != requested_flags) { - + /* No, not all the requested flags are present. Clear the flags present variable. */ flags_satisfied = ((ULONG) 0); } @@ -150,7 +150,7 @@ UINT interrupted_set_request; /* OR request is present. Simply or the requested flags and the current flags. */ flags_satisfied = (current_flags & requested_flags); } - + /* Determine if the request is satisfied. */ if (flags_satisfied != ((ULONG) 0)) { @@ -164,7 +164,7 @@ UINT interrupted_set_request; /* Determine whether or not clearing needs to take place. */ if (clear_request == TX_TRUE) { - + /* Yes, clear the flags that satisfied this request. */ group_ptr -> tx_event_flags_group_current = group_ptr -> tx_event_flags_group_current & (~requested_flags); @@ -190,16 +190,16 @@ UINT interrupted_set_request; /* Check for AND condition. All flags must be present to satisfy request. */ if (and_request == TX_AND) { - + /* AND request is present. */ - + /* Calculate the flags present. */ flags_satisfied = (current_flags & requested_flags); - + /* Determine if they satisfy the AND request. */ if (flags_satisfied != requested_flags) { - + /* No, not all the requested flags are present. Clear the flags present variable. */ flags_satisfied = ((ULONG) 0); } @@ -211,7 +211,7 @@ UINT interrupted_set_request; to see if any are present. */ flags_satisfied = (current_flags & requested_flags); } - + /* Determine if the request is satisfied. */ if (flags_satisfied != ((ULONG) 0)) { @@ -235,7 +235,7 @@ UINT interrupted_set_request; set request. */ if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS) { - + if (group_ptr -> tx_event_flags_group_suspension_list == TX_NULL) { @@ -252,7 +252,7 @@ UINT interrupted_set_request; event clearing until the set operation is complete. */ /* Remember the events to clear. */ - group_ptr -> tx_event_flags_group_delayed_clear = + group_ptr -> tx_event_flags_group_delayed_clear = group_ptr -> tx_event_flags_group_delayed_clear | requested_flags; } else @@ -279,7 +279,7 @@ UINT interrupted_set_request; /* Determine if the preempt disable flag is non-zero. */ if (_tx_thread_preempt_disable != ((UINT) 0)) { - + /* Suspension is not allowed if the preempt disable flag is non-zero at this point, return error completion. */ status = TX_NO_EVENTS; } @@ -296,7 +296,7 @@ UINT interrupted_set_request; /* Increment the number of event flags suspensions on this semaphore. */ group_ptr -> tx_event_flags_group___performance_suspension_count++; #endif - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) @@ -325,7 +325,7 @@ UINT interrupted_set_request; /* Pickup the suspended count. */ suspended_count = group_ptr -> tx_event_flags_group_suspended_count; - + /* Setup suspension list. */ if (suspended_count == TX_NO_SUSPENSIONS) { @@ -350,7 +350,7 @@ UINT interrupted_set_request; /* Increment the number of threads suspended. */ group_ptr -> tx_event_flags_group_suspended_count++; - + /* Set the state to suspended. */ thread_ptr -> tx_thread_state = TX_EVENT_FLAG; @@ -377,10 +377,10 @@ UINT interrupted_set_request; /* Call actual thread suspension routine. */ _tx_thread_system_suspend(thread_ptr); - + /* Disable interrupts. */ TX_DISABLE - + /* Return the completion status. */ status = thread_ptr -> tx_thread_suspend_status; #endif @@ -388,7 +388,7 @@ UINT interrupted_set_request; } else { - + /* Immediate return, return error completion. */ status = TX_NO_EVENTS; } diff --git a/common/src/tx_event_flags_info_get.c b/common/src/tx_event_flags_info_get.c index 05437417..feec2a9c 100644 --- a/common/src/tx_event_flags_info_get.c +++ b/common/src/tx_event_flags_info_get.c @@ -79,8 +79,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group) { @@ -102,7 +102,7 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the event flag group. */ if (name != TX_NULL) { - + *name = group_ptr -> tx_event_flags_group_name; } @@ -111,31 +111,31 @@ TX_INTERRUPT_SAVE_AREA { /* Pickup the current flags and apply delayed clearing. */ - *current_flags = group_ptr -> tx_event_flags_group_current & + *current_flags = group_ptr -> tx_event_flags_group_current & ~group_ptr -> tx_event_flags_group_delayed_clear; } /* Retrieve the first thread suspended on this event flag group. */ if (first_suspended != TX_NULL) { - + *first_suspended = group_ptr -> tx_event_flags_group_suspension_list; } /* Retrieve the number of threads suspended on this event flag group. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) group_ptr -> tx_event_flags_group_suspended_count; } - + /* Retrieve the pointer to the next event flag group created. */ if (next_group != TX_NULL) { - + *next_group = group_ptr -> tx_event_flags_group_created_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_event_flags_performance_info_get.c b/common/src/tx_event_flags_performance_info_get.c index 508756f1..a0cc23b0 100644 --- a/common/src/tx_event_flags_performance_info_get.c +++ b/common/src/tx_event_flags_performance_info_get.c @@ -94,15 +94,15 @@ UINT status; /* Determine if this is a legal request. */ if (group_ptr == TX_NULL) { - + /* Event flags group pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the event group ID is invalid. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { - + /* Event flags group pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -124,34 +124,34 @@ UINT status; /* Retrieve the number of set operations on this event flag group. */ if (sets != TX_NULL) { - + *sets = group_ptr -> tx_event_flags_group_performance_set_count; } - + /* Retrieve the number of get operations on this event flag group. */ if (gets != TX_NULL) { - + *gets = group_ptr -> tx_event_flags_group__performance_get_count; } - + /* Retrieve the number of thread suspensions on this event flag group. */ if (suspensions != TX_NULL) { - + *suspensions = group_ptr -> tx_event_flags_group___performance_suspension_count; } - + /* Retrieve the number of thread timeouts on this event flag group. */ if (timeouts != TX_NULL) { - + *timeouts = group_ptr -> tx_event_flags_group____performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE - + /* Return successful completion. */ status = TX_SUCCESS; } diff --git a/common/src/tx_event_flags_performance_system_info_get.c b/common/src/tx_event_flags_performance_system_info_get.c index 9d8dd0ad..8fdbb317 100644 --- a/common/src/tx_event_flags_performance_system_info_get.c +++ b/common/src/tx_event_flags_performance_system_info_get.c @@ -101,37 +101,37 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of event flag set operations. */ if (sets != TX_NULL) { - + *sets = _tx_event_flags_performance_set_count; } /* Retrieve the total number of event flag get operations. */ if (gets != TX_NULL) { - + *gets = _tx_event_flags_performance_get_count; } - + /* Retrieve the total number of event flag thread suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_event_flags_performance_suspension_count; } - + /* Retrieve the total number of event flag thread timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_event_flags_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; diff --git a/common/src/tx_event_flags_set.c b/common/src/tx_event_flags_set.c index 1fb30f9a..9228f4cd 100644 --- a/common/src/tx_event_flags_set.c +++ b/common/src/tx_event_flags_set.c @@ -137,7 +137,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ set request. */ if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS) { - + if (group_ptr -> tx_event_flags_group_suspension_list == TX_NULL) { @@ -154,15 +154,15 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ event clearing until the set operation is complete. */ /* Remember the events to clear. */ - group_ptr -> tx_event_flags_group_delayed_clear = + group_ptr -> tx_event_flags_group_delayed_clear = group_ptr -> tx_event_flags_group_delayed_clear | ~flags_to_set; } else { #endif - /* Previous set operation was not interrupted, simply clear the - specified flags by "ANDing" the flags into the current events + /* Previous set operation was not interrupted, simply clear the + specified flags by "ANDing" the flags into the current events of the group. */ group_ptr -> tx_event_flags_group_current = group_ptr -> tx_event_flags_group_current & flags_to_set; @@ -195,7 +195,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ { /* Yes, we need to neutralize the delayed clearing as well. */ - group_ptr -> tx_event_flags_group_delayed_clear = + group_ptr -> tx_event_flags_group_delayed_clear = group_ptr -> tx_event_flags_group_delayed_clear & ~flags_to_set; } #endif @@ -210,7 +210,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ if (group_ptr -> tx_event_flags_group_suspension_list != TX_NULL) { - /* Determine if there is just a single thread waiting on the event + /* Determine if there is just a single thread waiting on the event flag group. */ if (suspended_count == ((UINT) 1)) { @@ -223,7 +223,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Pickup the current event flags. */ current_event_flags = group_ptr -> tx_event_flags_group_current; - + /* Pickup the suspend information. */ requested_flags = thread_ptr -> tx_thread_suspend_info; @@ -236,16 +236,16 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Check for AND condition. All flags must be present to satisfy request. */ if (and_request == TX_AND) { - + /* AND request is present. */ - + /* Calculate the flags present. */ flags_satisfied = (current_event_flags & requested_flags); - + /* Determine if they satisfy the AND request. */ if (flags_satisfied != requested_flags) { - + /* No, not all the requested flags are present. Clear the flags present variable. */ flags_satisfied = ((ULONG) 0); } @@ -256,7 +256,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* OR request is present. Simply or the requested flags and the current flags. */ flags_satisfied = (current_event_flags & requested_flags); } - + /* Determine if the request is satisfied. */ if (flags_satisfied != ((ULONG) 0)) { @@ -315,7 +315,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ else { - /* Otherwise, the event flag requests of multiple threads must be + /* Otherwise, the event flag requests of multiple threads must be examined. */ /* Setup thread pointer, keep a local copy of the head pointer. */ @@ -325,7 +325,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Clear the suspended list head pointer to thwart manipulation of the list in ISR's while we are processing here. */ group_ptr -> tx_event_flags_group_suspension_list = TX_NULL; - + /* Setup the satisfied thread pointers. */ satisfied_list = TX_NULL; last_satisfied = TX_NULL; @@ -382,16 +382,16 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Check for AND condition. All flags must be present to satisfy request. */ if (and_request == TX_AND) { - + /* AND request is present. */ - + /* Calculate the flags present. */ flags_satisfied = (current_event_flags & requested_flags); - + /* Determine if they satisfy the AND request. */ if (flags_satisfied != requested_flags) { - + /* No, not all the requested flags are present. Clear the flags present variable. */ flags_satisfied = ((ULONG) 0); } @@ -402,13 +402,13 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* OR request is present. Simply or the requested flags and the current flags. */ flags_satisfied = (current_event_flags & requested_flags); } - - /* Check to see if the thread had a timeout or wait abort during the event search processing. - If so, just set the flags satisfied to ensure the processing here removes the thread from + + /* Check to see if the thread had a timeout or wait abort during the event search processing. + If so, just set the flags satisfied to ensure the processing here removes the thread from the suspension list. */ if (thread_ptr -> tx_thread_state != TX_EVENT_FLAG) { - + /* Simply set the satisfied flags to 1 in order to remove the thread from the suspension list. */ flags_satisfied = ((ULONG) 1); } @@ -421,7 +421,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Set the preempt check flag. */ preempt_check = TX_TRUE; - + /* Determine if the thread is still suspended on the event flag group. If not, a wait abort must have been done from an ISR. */ if (thread_ptr -> tx_thread_state == TX_EVENT_FLAG) @@ -437,11 +437,11 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Determine whether or not clearing needs to take place. */ if (clear_request == TX_TRUE) { - + /* Yes, clear the flags that satisfied this request. */ group_ptr -> tx_event_flags_group_current = group_ptr -> tx_event_flags_group_current & ~requested_flags; } - + /* Prepare for resumption of the first thread. */ /* Clear cleanup routine to avoid timeout. */ @@ -478,7 +478,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ list. */ if (suspended_list == thread_ptr) { - + /* Yes, head pointer needs to be updated. */ suspended_list = thread_ptr -> tx_thread_suspended_next; } @@ -494,7 +494,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* First thread on the satisfied list. */ satisfied_list = thread_ptr; last_satisfied = thread_ptr; - + /* Setup initial next pointer. */ thread_ptr -> tx_thread_suspended_next = TX_NULL; } @@ -502,7 +502,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ { /* Not the first thread on the satisfied list. */ - + /* Link it up at the end. */ last_satisfied -> tx_thread_suspended_next = thread_ptr; thread_ptr -> tx_thread_suspended_next = TX_NULL; @@ -515,7 +515,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Decrement the suspension count. */ suspended_count--; - + } while (suspended_count != TX_NO_SUSPENSIONS); /* Setup the group's suspension list head again. */ @@ -543,7 +543,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ thread_ptr = satisfied_list; while(thread_ptr != TX_NULL) { - + /* Get next pointer first. */ next_thread_ptr = thread_ptr -> tx_thread_suspended_next; @@ -586,7 +586,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Determine if we need to set the reset search field. */ if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS) { - + /* We interrupted a search of an event flag group suspension list. Make sure we reset the search. */ group_ptr -> tx_event_flags_group_reset_search = TX_TRUE; diff --git a/common/src/tx_initialize_high_level.c b/common/src/tx_initialize_high_level.c index e9d90324..c7914fc6 100644 --- a/common/src/tx_initialize_high_level.c +++ b/common/src/tx_initialize_high_level.c @@ -44,9 +44,9 @@ #include "tx_byte_pool.h" -/* Define the unused memory pointer. The value of the first available +/* Define the unused memory pointer. The value of the first available memory address is placed in this variable in the low-level - initialization function. The content of this variable is passed + initialization function. The content of this variable is passed to the application's system definition function. */ VOID *_tx_initialize_unused_memory; diff --git a/common/src/tx_initialize_kernel_enter.c b/common/src/tx_initialize_kernel_enter.c index 5f27db43..c18cec37 100644 --- a/common/src/tx_initialize_kernel_enter.c +++ b/common/src/tx_initialize_kernel_enter.c @@ -98,8 +98,8 @@ VOID _tx_initialize_kernel_enter(VOID) /* No, the initialization still needs to take place. */ - /* Ensure that the system state variable is set to indicate - initialization is in progress. Note that this variable is + /* Ensure that the system state variable is set to indicate + initialization is in progress. Note that this variable is later used to represent interrupt nesting. */ _tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS; @@ -109,9 +109,9 @@ VOID _tx_initialize_kernel_enter(VOID) /* Invoke the low-level initialization to handle all processor specific initialization issues. */ _tx_initialize_low_level(); - - /* Invoke the high-level initialization to exercise all of the - ThreadX components and the application's initialization + + /* Invoke the high-level initialization to exercise all of the + ThreadX components and the application's initialization function. */ _tx_initialize_high_level(); @@ -122,8 +122,8 @@ VOID _tx_initialize_kernel_enter(VOID) /* Optional processing extension. */ TX_INITIALIZE_KERNEL_ENTER_EXTENSION - /* Ensure that the system state variable is set to indicate - initialization is in progress. Note that this variable is + /* Ensure that the system state variable is set to indicate + initialization is in progress. Note that this variable is later used to represent interrupt nesting. */ _tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS; @@ -131,7 +131,7 @@ VOID _tx_initialize_kernel_enter(VOID) first available memory address to it. */ tx_application_define(_tx_initialize_unused_memory); - /* Set the system state in preparation for entering the thread + /* Set the system state in preparation for entering the thread scheduler. */ _tx_thread_system_state = TX_INITIALIZE_IS_FINISHED; diff --git a/common/src/tx_initialize_kernel_setup.c b/common/src/tx_initialize_kernel_setup.c index c8dc3fa0..c0923a0c 100644 --- a/common/src/tx_initialize_kernel_setup.c +++ b/common/src/tx_initialize_kernel_setup.c @@ -76,8 +76,8 @@ VOID _tx_initialize_kernel_setup(VOID) { - /* Ensure that the system state variable is set to indicate - initialization is in progress. Note that this variable is + /* Ensure that the system state variable is set to indicate + initialization is in progress. Note that this variable is later used to represent interrupt nesting. */ _tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS; @@ -87,9 +87,9 @@ VOID _tx_initialize_kernel_setup(VOID) /* Invoke the low-level initialization to handle all processor specific initialization issues. */ _tx_initialize_low_level(); - - /* Invoke the high-level initialization to exercise all of the - ThreadX components and the application's initialization + + /* Invoke the high-level initialization to exercise all of the + ThreadX components and the application's initialization function. */ _tx_initialize_high_level(); diff --git a/common/src/tx_misra.c b/common/src/tx_misra.c index ad463d3a..8b8439bc 100644 --- a/common/src/tx_misra.c +++ b/common/src/tx_misra.c @@ -92,7 +92,7 @@ ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2) { ULONG value; - + value = (ULONG)(ptr1 - ptr2); return(value); } @@ -150,7 +150,7 @@ ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount) ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2) { ULONG value; - + value = (ULONG)(ptr1 - ptr2); return(value); } @@ -362,7 +362,7 @@ TX_THREAD *trace_thread_ptr; #endif trace_event_ptr++; if (trace_event_ptr >= _tx_trace_buffer_end_ptr) - { + { trace_event_ptr = _tx_trace_buffer_start_ptr; _tx_trace_buffer_current_ptr = trace_event_ptr; _tx_trace_header_ptr -> tx_trace_header_buffer_current_pointer = (ULONG) trace_event_ptr; @@ -813,7 +813,7 @@ UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer) /* Return a UCHAR pointer. */ return((UCHAR *) ((VOID *) pointer)); } - + #endif diff --git a/common/src/tx_mutex_cleanup.c b/common/src/tx_mutex_cleanup.c index aac2950c..ec62600e 100644 --- a/common/src/tx_mutex_cleanup.c +++ b/common/src/tx_mutex_cleanup.c @@ -100,14 +100,14 @@ TX_THREAD *previous_thread; /* Check for valid suspension sequence. */ if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence) { - + /* Setup pointer to mutex control block. */ mutex_ptr = TX_VOID_TO_MUTEX_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block); - + /* Check for NULL mutex pointer. */ if (mutex_ptr != TX_NULL) { - + /* Determine if the mutex ID is valid. */ if (mutex_ptr -> tx_mutex_id == TX_MUTEX_ID) { @@ -133,7 +133,7 @@ TX_THREAD *previous_thread; suspended_count = mutex_ptr -> tx_mutex_suspended_count; /* Remove the suspended thread from the list. */ - + /* See if this is the only suspended thread on the list. */ if (suspended_count == TX_NO_SUSPENSIONS) { @@ -147,7 +147,7 @@ TX_THREAD *previous_thread; { /* At least one more thread is on the same suspension list. */ - + /* Update the links of the adjacent threads. */ next_thread = thread_ptr -> tx_thread_suspended_next; previous_thread = thread_ptr -> tx_thread_suspended_previous; @@ -157,18 +157,18 @@ TX_THREAD *previous_thread; /* Determine if we need to update the head pointer. */ if (mutex_ptr -> tx_mutex_suspension_list == thread_ptr) { - + /* Update the list head pointer. */ mutex_ptr -> tx_mutex_suspension_list = next_thread; } } - + /* Now we need to determine if this cleanup is from a terminate, timeout, or from a wait abort. */ if (thread_ptr -> tx_thread_state == TX_MUTEX_SUSP) { - /* Timeout condition and the thread still suspended on the mutex. + /* Timeout condition and the thread still suspended on the mutex. Setup return error status and resume the thread. */ #ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO @@ -194,7 +194,7 @@ TX_THREAD *previous_thread; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread! */ _tx_thread_system_resume(thread_ptr); @@ -208,7 +208,7 @@ TX_THREAD *previous_thread; } } } - + /* Restore interrupts. */ TX_RESTORE #endif @@ -269,21 +269,21 @@ UINT status; /* Disable interrupts. */ TX_DISABLE - + /* Temporarily disable preemption. */ _tx_thread_preempt_disable++; /* Loop to look at all the mutexes. */ do { - + /* Pickup the mutex head pointer. */ mutex_ptr = thread_ptr -> tx_thread_owned_mutex_list; /* Determine if there is a mutex. */ if (mutex_ptr != TX_NULL) { - + /* Yes, set the ownership count to 1. */ mutex_ptr -> tx_mutex_ownership_count = ((UINT) 1); @@ -307,10 +307,10 @@ UINT status; mutex_ptr = thread_ptr -> tx_thread_owned_mutex_list; } } while (mutex_ptr != TX_NULL); - + /* Restore preemption. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE } diff --git a/common/src/tx_mutex_create.c b/common/src/tx_mutex_create.c index 7925528a..a811df87 100644 --- a/common/src/tx_mutex_create.c +++ b/common/src/tx_mutex_create.c @@ -88,7 +88,7 @@ TX_MUTEX *previous_mutex; /* Setup the basic mutex fields. */ mutex_ptr -> tx_mutex_name = name_ptr; mutex_ptr -> tx_mutex_inherit = inherit; - + /* Disable interrupts to place the mutex on the created list. */ TX_DISABLE @@ -126,7 +126,7 @@ TX_MUTEX *previous_mutex; /* Increment the ownership count. */ _tx_mutex_created_count++; - + /* Optional mutex create extended processing. */ TX_MUTEX_CREATE_EXTENSION(mutex_ptr) diff --git a/common/src/tx_mutex_delete.c b/common/src/tx_mutex_delete.c index 7c3becc0..76a4441f 100644 --- a/common/src/tx_mutex_delete.c +++ b/common/src/tx_mutex_delete.c @@ -110,7 +110,7 @@ UINT status; /* Decrement the created count. */ _tx_mutex_created_count--; - + /* See if the mutex is the only one on the list. */ if (_tx_mutex_created_count == TX_EMPTY) { @@ -130,7 +130,7 @@ UINT status; /* See if we have to update the created list head pointer. */ if (_tx_mutex_created_ptr == mutex_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_mutex_created_ptr = next_mutex; } @@ -156,7 +156,7 @@ UINT status; { /* Yes, remove this mutex from the owned list. */ - + /* Set the ownership count to 1. */ mutex_ptr -> tx_mutex_ownership_count = ((UINT) 1); @@ -184,14 +184,14 @@ UINT status; on this mutex. */ while (suspended_count != ((ULONG) 0)) { - + /* Decrement the suspension count. */ suspended_count--; - + /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; @@ -215,7 +215,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread. */ _tx_thread_system_resume(thread_ptr); #endif diff --git a/common/src/tx_mutex_get.c b/common/src/tx_mutex_get.c index 83c438a2..d5c9a077 100644 --- a/common/src/tx_mutex_get.c +++ b/common/src/tx_mutex_get.c @@ -126,7 +126,7 @@ UINT status; /* Determine if priority inheritance is required. */ if (mutex_ptr -> tx_mutex_inherit == TX_TRUE) { - + /* Remember the current priority of thread. */ mutex_ptr -> tx_mutex_original_priority = thread_ptr -> tx_thread_priority; @@ -178,7 +178,7 @@ UINT status; else if (mutex_ptr -> tx_mutex_owner == thread_ptr) { - /* The owning thread is requesting the mutex again, just + /* The owning thread is requesting the mutex again, just increment the ownership count. */ mutex_ptr -> tx_mutex_ownership_count++; @@ -279,7 +279,7 @@ UINT status; previous_thread -> tx_thread_suspended_next = thread_ptr; next_thread -> tx_thread_suspended_previous = thread_ptr; } - + /* Increment the suspension count. */ mutex_ptr -> tx_mutex_suspended_count++; @@ -288,7 +288,7 @@ UINT status; #ifdef TX_NOT_INTERRUPTABLE - /* Determine if we need to raise the priority of the thread + /* Determine if we need to raise the priority of the thread owning the mutex. */ if (mutex_ptr -> tx_mutex_inherit == TX_TRUE) { @@ -304,7 +304,7 @@ UINT status; /* Determine if we have to update inherit priority level of the mutex owner. */ if (thread_ptr -> tx_thread_priority < mutex_owner -> tx_thread_inherit_priority) { - + /* Remember the new priority inheritance priority. */ mutex_owner -> tx_thread_inherit_priority = thread_ptr -> tx_thread_priority; } @@ -347,7 +347,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - /* Determine if we need to raise the priority of the thread + /* Determine if we need to raise the priority of the thread owning the mutex. */ if (mutex_ptr -> tx_mutex_inherit == TX_TRUE) { @@ -363,7 +363,7 @@ UINT status; /* Determine if we have to update inherit priority level of the mutex owner. */ if (thread_ptr -> tx_thread_priority < mutex_owner -> tx_thread_inherit_priority) { - + /* Remember the new priority inheritance priority. */ mutex_owner -> tx_thread_inherit_priority = thread_ptr -> tx_thread_priority; } diff --git a/common/src/tx_mutex_info_get.c b/common/src/tx_mutex_info_get.c index f43e96e5..b28f9479 100644 --- a/common/src/tx_mutex_info_get.c +++ b/common/src/tx_mutex_info_get.c @@ -79,7 +79,7 @@ /* */ /**************************************************************************/ UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex) { @@ -101,45 +101,45 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the mutex. */ if (name != TX_NULL) { - + *name = mutex_ptr -> tx_mutex_name; } - + /* Retrieve the current ownership count of the mutex. */ if (count != TX_NULL) { - + *count = ((ULONG) mutex_ptr -> tx_mutex_ownership_count); } - + /* Retrieve the current owner of the mutex. */ if (owner != TX_NULL) { - + *owner = mutex_ptr -> tx_mutex_owner; } - + /* Retrieve the first thread suspended on this mutex. */ if (first_suspended != TX_NULL) { - + *first_suspended = mutex_ptr -> tx_mutex_suspension_list; } - + /* Retrieve the number of threads suspended on this mutex. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) mutex_ptr -> tx_mutex_suspended_count; } - + /* Retrieve the pointer to the next mutex created. */ if (next_mutex != TX_NULL) { - + *next_mutex = mutex_ptr -> tx_mutex_created_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_mutex_performance_info_get.c b/common/src/tx_mutex_performance_info_get.c index b154f15e..7bd0512e 100644 --- a/common/src/tx_mutex_performance_info_get.c +++ b/common/src/tx_mutex_performance_info_get.c @@ -99,15 +99,15 @@ UINT status; /* Determine if this is a legal request. */ if (mutex_ptr == TX_NULL) { - + /* Mutex pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the mutex ID is invalid. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { - + /* Mutex pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -129,45 +129,45 @@ UINT status; /* Retrieve the number of puts on this mutex. */ if (puts != TX_NULL) { - + *puts = mutex_ptr -> tx_mutex_performance_put_count; } - + /* Retrieve the number of gets on this mutex. */ if (gets != TX_NULL) { - + *gets = mutex_ptr -> tx_mutex_performance_get_count; } - + /* Retrieve the number of suspensions on this mutex. */ if (suspensions != TX_NULL) { - + *suspensions = mutex_ptr -> tx_mutex_performance_suspension_count; } - + /* Retrieve the number of timeouts on this mutex. */ if (timeouts != TX_NULL) { - + *timeouts = mutex_ptr -> tx_mutex_performance_timeout_count; } - + /* Retrieve the number of priority inversions on this mutex. */ if (inversions != TX_NULL) { - + *inversions = mutex_ptr -> tx_mutex_performance_priority_inversion_count; } - + /* Retrieve the number of priority inheritances on this mutex. */ if (inheritances != TX_NULL) { - + *inheritances = mutex_ptr -> tx_mutex_performance__priority_inheritance_count; } - + /* Restore interrupts. */ TX_RESTORE } @@ -225,7 +225,7 @@ UINT status; status = TX_FEATURE_NOT_ENABLED; } #endif - + /* Return completion status. */ return(status); } diff --git a/common/src/tx_mutex_performance_system_info_get.c b/common/src/tx_mutex_performance_system_info_get.c index a06c228c..04409e7b 100644 --- a/common/src/tx_mutex_performance_system_info_get.c +++ b/common/src/tx_mutex_performance_system_info_get.c @@ -82,7 +82,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, +UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances) { @@ -106,51 +106,51 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of mutex puts. */ if (puts != TX_NULL) { - + *puts = _tx_mutex_performance_put_count; } - + /* Retrieve the total number of mutex gets. */ if (gets != TX_NULL) { - + *gets = _tx_mutex_performance_get_count; } - + /* Retrieve the total number of mutex suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_mutex_performance_suspension_count; } - + /* Retrieve the total number of mutex timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_mutex_performance_timeout_count; } - + /* Retrieve the total number of mutex priority inversions. */ if (inversions != TX_NULL) { - + *inversions = _tx_mutex_performance_priority_inversion_count; } - + /* Retrieve the total number of mutex priority inheritances. */ if (inheritances != TX_NULL) { - + *inheritances = _tx_mutex_performance__priority_inheritance_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -159,43 +159,43 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (puts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (gets != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (inversions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (inheritances != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_mutex_prioritize.c b/common/src/tx_mutex_prioritize.c index 5de8641a..3aae0e18 100644 --- a/common/src/tx_mutex_prioritize.c +++ b/common/src/tx_mutex_prioritize.c @@ -164,28 +164,28 @@ UINT status; /* Disable interrupts again. */ TX_DISABLE - /* Determine if any changes to the list have occurred while + /* Determine if any changes to the list have occurred while interrupts were enabled. */ - + /* Is the list head the same? */ if (head_ptr != mutex_ptr -> tx_mutex_suspension_list) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } else { - + /* Is the suspended count the same? */ if (suspended_count != mutex_ptr -> tx_mutex_suspended_count) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } } - + /* Determine if the list has changed. */ if (list_changed == TX_FALSE) { @@ -215,12 +215,12 @@ UINT status; /* Release preemption. */ _tx_thread_preempt_disable--; - /* Now determine if the highest priority thread is at the front + /* Now determine if the highest priority thread is at the front of the list. */ if (priority_thread_ptr != head_ptr) { - /* No, we need to move the highest priority suspended thread to the + /* No, we need to move the highest priority suspended thread to the front of the list. */ /* First, remove the highest priority thread by updating the diff --git a/common/src/tx_mutex_priority_change.c b/common/src/tx_mutex_priority_change.c index 809d0a21..d4945d83 100644 --- a/common/src/tx_mutex_priority_change.c +++ b/common/src/tx_mutex_priority_change.c @@ -116,17 +116,17 @@ UINT map_index; /* Change thread priority to the new mutex priority-inheritance priority. */ thread_ptr -> tx_thread_priority = new_priority; - + /* Determine how to setup the thread's preemption-threshold. */ if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority) { - + /* Change thread preemption-threshold to the user's preemption-threshold. */ thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold; } else { - + /* Change the thread preemption-threshold to the new threshold. */ thread_ptr -> tx_thread_preempt_threshold = new_priority; } @@ -156,22 +156,22 @@ UINT map_index; /* Call actual non-interruptable thread suspension routine. */ _tx_thread_system_ni_suspend(thread_ptr, ((ULONG) 0)); - /* At this point, the preempt disable flag is still set, so we still have + /* At this point, the preempt disable flag is still set, so we still have protection against all preemption. */ /* Change thread priority to the new mutex priority-inheritance priority. */ thread_ptr -> tx_thread_priority = new_priority; - + /* Determine how to setup the thread's preemption-threshold. */ if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority) { - + /* Change thread preemption-threshold to the user's preemption-threshold. */ thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold; } else { - + /* Change the thread preemption-threshold to the new threshold. */ thread_ptr -> tx_thread_preempt_threshold = new_priority; } @@ -198,29 +198,29 @@ UINT map_index; /* Restore interrupts. */ TX_RESTORE - /* The thread is ready and must first be removed from the list. Call the + /* The thread is ready and must first be removed from the list. Call the system suspend function to accomplish this. */ _tx_thread_system_suspend(thread_ptr); /* Disable interrupts. */ TX_DISABLE - /* At this point, the preempt disable flag is still set, so we still have + /* At this point, the preempt disable flag is still set, so we still have protection against all preemption. */ /* Change thread priority to the new mutex priority-inheritance priority. */ thread_ptr -> tx_thread_priority = new_priority; - + /* Determine how to setup the thread's preemption-threshold. */ if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority) { - + /* Change thread preemption-threshold to the user's preemption-threshold. */ thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold; } else { - + /* Change the thread preemption-threshold to the new threshold. */ thread_ptr -> tx_thread_preempt_threshold = new_priority; } @@ -240,14 +240,14 @@ UINT map_index; /* Disable interrupts. */ TX_DISABLE #endif - + /* Pickup the next thread to execute. */ next_execute_ptr = _tx_thread_execute_ptr; /* Determine if this thread is not the next thread to execute. */ if (thread_ptr != next_execute_ptr) { - + /* Make sure the thread is still ready. */ if (thread_ptr -> tx_thread_state == TX_READY) { @@ -269,7 +269,7 @@ UINT map_index; /* Determine if we moved to a lower priority. If so, move the thread to the front of its priority list. */ if (original_priority < new_priority) { - + /* Ensure that this thread is placed at the front of the priority list. */ _tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr; } @@ -287,7 +287,7 @@ UINT map_index; /* Compare the next thread to execute thread's priority against the thread's preemption-threshold. */ if (thread_ptr -> tx_thread_preempt_threshold <= next_execute_ptr -> tx_thread_priority) { - + /* We must swap execute pointers to enforce the preemption-threshold of a thread coming out of priority inheritance. */ _tx_thread_execute_ptr = thread_ptr; @@ -295,7 +295,7 @@ UINT map_index; /* Determine if we moved to a lower priority. If so, move the thread to the front of its priority list. */ if (original_priority < new_priority) { - + /* Ensure that this thread is placed at the front of the priority list. */ _tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr; } @@ -330,7 +330,7 @@ UINT map_index; } #ifndef TX_NOT_INTERRUPTABLE - + /* Restore interrupts. */ TX_RESTORE #endif diff --git a/common/src/tx_mutex_put.c b/common/src/tx_mutex_put.c index fe3a49fd..46b4c29f 100644 --- a/common/src/tx_mutex_put.c +++ b/common/src/tx_mutex_put.c @@ -131,8 +131,8 @@ UINT inheritance_priority; /* Check to see if the mutex is owned by the calling thread. */ if (mutex_ptr -> tx_mutex_owner != current_thread) { - - /* Determine if the preempt disable flag is set, indicating that + + /* Determine if the preempt disable flag is set, indicating that the caller is not the application but from ThreadX. In such cases, the thread mutex owner does not need to match. */ if (_tx_thread_preempt_disable == ((UINT) 0)) @@ -147,11 +147,11 @@ UINT inheritance_priority; status = TX_NOT_OWNED; } } - + /* Determine if we should continue. */ if (status == TX_NOT_DONE) { - + /* Decrement the mutex ownership count. */ mutex_ptr -> tx_mutex_ownership_count--; @@ -182,9 +182,9 @@ UINT inheritance_priority; { /* The mutex is now available. */ - + /* Remove this mutex from the owned mutex list. */ - + /* Decrement the ownership count. */ thread_ptr -> tx_thread_owned_mutex_count--; @@ -218,14 +218,14 @@ UINT inheritance_priority; /* Determine if the simple, non-suspension, non-priority inheritance case is present. */ if (mutex_ptr -> tx_mutex_suspension_list == TX_NULL) { - + /* Is this a priority inheritance mutex? */ if (mutex_ptr -> tx_mutex_inherit == TX_FALSE) { /* Yes, we are done - set the mutex owner to NULL. */ mutex_ptr -> tx_mutex_owner = TX_NULL; - + /* Restore interrupts. */ TX_RESTORE @@ -233,11 +233,11 @@ UINT inheritance_priority; status = TX_SUCCESS; } } - + /* Determine if the processing is complete. */ if (status == TX_NOT_DONE) { - + /* Initialize original owner and thread priority. */ old_owner = TX_NULL; old_priority = thread_ptr -> tx_thread_user_priority; @@ -257,8 +257,8 @@ UINT inheritance_priority; /* Default the inheritance priority to disabled. */ inheritance_priority = ((UINT) TX_MAX_PRIORITIES); - - /* Search the owned mutexes for this thread to determine the highest priority for this + + /* Search the owned mutexes for this thread to determine the highest priority for this former mutex owner to return to. */ next_mutex = thread_ptr -> tx_thread_owned_mutex_list; while (next_mutex != TX_NULL) @@ -267,8 +267,8 @@ UINT inheritance_priority; /* Does this mutex support priority inheritance? */ if (next_mutex -> tx_mutex_inherit == TX_TRUE) { - - /* Determine if highest priority field of the mutex is higher than the priority to + + /* Determine if highest priority field of the mutex is higher than the priority to restore. */ if (next_mutex -> tx_mutex_highest_priority_waiting < inheritance_priority) { @@ -284,7 +284,7 @@ UINT inheritance_priority; /* Are we at the end of the list? */ if (next_mutex == thread_ptr -> tx_thread_owned_mutex_list) { - + /* Yes, set the next mutex to NULL. */ next_mutex = TX_NULL; } @@ -298,14 +298,14 @@ UINT inheritance_priority; /* Undo the temporarily preemption disable. */ _tx_thread_preempt_disable--; #endif - + /* Set the inherit priority to that of the highest priority thread waiting on the mutex. */ thread_ptr -> tx_thread_inherit_priority = inheritance_priority; - + /* Determine if the inheritance priority is less than the default old priority. */ if (inheritance_priority < old_priority) { - + /* Yes, update the old priority. */ old_priority = inheritance_priority; } @@ -332,7 +332,7 @@ UINT inheritance_priority; TX_RESTORE #endif - /* Call the mutex prioritize processing to ensure the + /* Call the mutex prioritize processing to ensure the highest priority thread is resumed. */ #ifdef TX_MISRA_ENABLE do @@ -375,17 +375,17 @@ UINT inheritance_priority; TX_RESTORE #endif - /* Mutex is not owned, but it is possible that a thread that + /* Mutex is not owned, but it is possible that a thread that caused a priority inheritance to occur is no longer waiting on the mutex. */ /* Setup the highest priority waiting thread. */ mutex_ptr -> tx_mutex_highest_priority_waiting = (UINT) TX_MAX_PRIORITIES; - + /* Determine if we need to restore priority. */ if ((mutex_ptr -> tx_mutex_owner) -> tx_thread_priority != old_priority) { - + /* Yes, restore the priority of thread. */ _tx_mutex_priority_change(mutex_ptr -> tx_mutex_owner, old_priority); } @@ -424,7 +424,7 @@ UINT inheritance_priority; /* Remember the old mutex owner. */ old_owner = mutex_ptr -> tx_mutex_owner; - + /* Setup owner thread priority information. */ mutex_ptr -> tx_mutex_original_priority = thread_ptr -> tx_thread_priority; @@ -473,7 +473,7 @@ UINT inheritance_priority; /* Decrement the suspension count. */ mutex_ptr -> tx_mutex_suspended_count--; - + /* Pickup the suspended count. */ suspended_count = mutex_ptr -> tx_mutex_suspended_count; @@ -482,7 +482,7 @@ UINT inheritance_priority; { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ mutex_ptr -> tx_mutex_suspension_list = TX_NULL; } @@ -536,7 +536,7 @@ UINT inheritance_priority; _tx_mutex_prioritize(mutex_ptr); #endif } - + /* Now, pickup the list head and set the priority. */ /* Determine if there still are threads suspended for this mutex. */ @@ -551,11 +551,11 @@ UINT inheritance_priority; /* Restore previous priority needs to be restored after priority inheritance. */ - + /* Determine if we need to restore priority. */ if (old_owner -> tx_thread_priority != old_priority) { - + /* Restore priority of thread. */ _tx_mutex_priority_change(old_owner, old_priority); } @@ -579,7 +579,7 @@ UINT inheritance_priority; { /* Yes, priority inheritance is requested. */ - + /* Determine if there are any more threads still suspended on the mutex. */ if (mutex_ptr -> tx_mutex_suspended_count != TX_NO_SUSPENSIONS) { @@ -594,7 +594,7 @@ UINT inheritance_priority; #else _tx_mutex_prioritize(mutex_ptr); #endif - + /* Now, pickup the list head and set the priority. */ /* Optional processing extension. */ @@ -618,11 +618,11 @@ UINT inheritance_priority; /* Restore previous priority needs to be restored after priority inheritance. */ - + /* Is the priority different? */ if (old_owner -> tx_thread_priority != old_priority) { - + /* Restore the priority of thread. */ _tx_mutex_priority_change(old_owner, old_priority); } @@ -631,7 +631,7 @@ UINT inheritance_priority; /* Resume thread. */ _tx_thread_system_resume(thread_ptr); #endif - + /* Return a successful status. */ status = TX_SUCCESS; } @@ -645,7 +645,7 @@ UINT inheritance_priority; /* Restore interrupts. */ TX_RESTORE - + /* Caller does not own the mutex. */ status = TX_NOT_OWNED; } diff --git a/common/src/tx_queue_cleanup.c b/common/src/tx_queue_cleanup.c index 93e24e04..c6c9f935 100644 --- a/common/src/tx_queue_cleanup.c +++ b/common/src/tx_queue_cleanup.c @@ -87,7 +87,7 @@ UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; - + #ifndef TX_NOT_INTERRUPTABLE /* Disable interrupts to remove the suspended thread from the queue. */ @@ -96,7 +96,7 @@ TX_THREAD *previous_thread; /* Determine if the cleanup is still required. */ if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_queue_cleanup)) { - + /* Check for valid suspension sequence. */ if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence) { @@ -122,7 +122,7 @@ TX_THREAD *previous_thread; #endif /* Yes, we still have thread suspension! */ - + /* Clear the suspension cleanup flag. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; @@ -168,7 +168,7 @@ TX_THREAD *previous_thread; if (thread_ptr -> tx_thread_state == TX_QUEUE_SUSP) { - /* Timeout condition and the thread still suspended on the queue. + /* Timeout condition and the thread still suspended on the queue. Setup return error status and resume the thread. */ #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO @@ -183,17 +183,17 @@ TX_THREAD *previous_thread; /* Setup return status. */ if (queue_ptr -> tx_queue_enqueued != TX_NO_MESSAGES) { - + /* Queue full timeout! */ thread_ptr -> tx_thread_suspend_status = TX_QUEUE_FULL; } else { - + /* Queue empty timeout! */ thread_ptr -> tx_thread_suspend_status = TX_QUEUE_EMPTY; } - + #ifdef TX_NOT_INTERRUPTABLE /* Resume the thread! */ diff --git a/common/src/tx_queue_create.c b/common/src/tx_queue_create.c index 522075e5..01aec360 100644 --- a/common/src/tx_queue_create.c +++ b/common/src/tx_queue_create.c @@ -74,7 +74,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, +UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size) { @@ -91,7 +91,7 @@ TX_QUEUE *previous_queue; /* Setup the basic queue fields. */ queue_ptr -> tx_queue_name = name_ptr; - + /* Save the message size in the control block. */ queue_ptr -> tx_queue_message_size = message_size; @@ -100,7 +100,7 @@ TX_QUEUE *previous_queue; capacity = (UINT) (queue_size / ((ULONG) (((ULONG) message_size) * (sizeof(ULONG))))); used_words = capacity * message_size; - /* Save the starting address and calculate the ending address of + /* Save the starting address and calculate the ending address of the queue. Note that the ending address is really one past the end! */ queue_ptr -> tx_queue_start = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start); diff --git a/common/src/tx_queue_delete.c b/common/src/tx_queue_delete.c index 32c6e49a..c0fb13ce 100644 --- a/common/src/tx_queue_delete.c +++ b/common/src/tx_queue_delete.c @@ -125,7 +125,7 @@ TX_QUEUE *previous_queue; /* See if we have to update the created list head pointer. */ if (_tx_queue_created_ptr == queue_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_queue_created_ptr = next_queue; } @@ -147,14 +147,14 @@ TX_QUEUE *previous_queue; on this queue. */ while (suspended_count != TX_NO_SUSPENSIONS) { - + /* Decrement the suspension count. */ suspended_count--; /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; diff --git a/common/src/tx_queue_flush.c b/common/src/tx_queue_flush.c index 35855806..ac5c7e36 100644 --- a/common/src/tx_queue_flush.c +++ b/common/src/tx_queue_flush.c @@ -113,7 +113,7 @@ TX_THREAD *thread_ptr; if (queue_ptr -> tx_queue_suspended_count != TX_NO_SUSPENSIONS) { - /* Yes, there are threads suspended on this queue, they must be + /* Yes, there are threads suspended on this queue, they must be resumed! */ /* Copy the information into temporary variables. */ @@ -141,24 +141,24 @@ TX_THREAD *thread_ptr; thread_ptr = suspension_list; while (suspended_count != ((ULONG) 0)) { - + /* Decrement the suspension count. */ suspended_count--; /* Check for a NULL thread pointer. */ if (thread_ptr == TX_NULL) { - + /* Get out of the loop. */ break; } /* Resume the next suspended thread. */ - + /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; @@ -182,7 +182,7 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread. */ _tx_thread_system_resume(thread_ptr -> tx_thread_suspended_previous); #endif diff --git a/common/src/tx_queue_front_send.c b/common/src/tx_queue_front_send.c index f183cba7..51e7b935 100644 --- a/common/src/tx_queue_front_send.c +++ b/common/src/tx_queue_front_send.c @@ -123,7 +123,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); if (queue_ptr -> tx_queue_available_storage != ((UINT) 0)) { - /* Yes there is room in the queue. Now determine if there is a thread waiting + /* Yes there is room in the queue. Now determine if there is a thread waiting for a message. */ if (suspended_count == TX_NO_SUSPENSIONS) { @@ -137,20 +137,20 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* See if the read pointer is at the beginning of the queue area. */ if (queue_ptr -> tx_queue_read == queue_ptr -> tx_queue_start) { - + /* Adjust the read pointer to the last message at the end of the queue. */ queue_ptr -> tx_queue_read = TX_ULONG_POINTER_SUB(queue_ptr -> tx_queue_end, queue_ptr -> tx_queue_message_size); } else { - + /* Not at the beginning of the queue, just move back one message. */ queue_ptr -> tx_queue_read = TX_ULONG_POINTER_SUB(queue_ptr -> tx_queue_read, queue_ptr -> tx_queue_message_size); } /* Simply place the message in the queue. */ - + /* Reduce the amount of available storage. */ queue_ptr -> tx_queue_available_storage--; @@ -162,7 +162,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); destination = queue_ptr -> tx_queue_read; size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -241,7 +241,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -300,7 +300,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Yes, suspension is requested. */ /* Prepare for suspension of this thread. */ - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) @@ -345,7 +345,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); next_thread -> tx_thread_suspended_previous = thread_ptr; /* Update the suspension list to put this thread in front, which will put - the message that was removed in the proper relative order when room is + the message that was removed in the proper relative order when room is made in the queue. */ queue_ptr -> tx_queue_suspension_list = thread_ptr; } diff --git a/common/src/tx_queue_info_get.c b/common/src/tx_queue_info_get.c index 5e94d41e..3275db72 100644 --- a/common/src/tx_queue_info_get.c +++ b/common/src/tx_queue_info_get.c @@ -99,45 +99,45 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the queue. */ if (name != TX_NULL) { - + *name = queue_ptr -> tx_queue_name; } - + /* Retrieve the number of messages currently in the queue. */ if (enqueued != TX_NULL) { - + *enqueued = (ULONG) queue_ptr -> tx_queue_enqueued; } - + /* Retrieve the number of messages that will still fit in the queue. */ if (available_storage != TX_NULL) { - + *available_storage = (ULONG) queue_ptr -> tx_queue_available_storage; } - + /* Retrieve the first thread suspended on this queue. */ if (first_suspended != TX_NULL) { - + *first_suspended = queue_ptr -> tx_queue_suspension_list; } - + /* Retrieve the number of threads suspended on this queue. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) queue_ptr -> tx_queue_suspended_count; } - + /* Retrieve the pointer to the next queue created. */ if (next_queue != TX_NULL) { - + *next_queue = queue_ptr -> tx_queue_created_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_queue_performance_info_get.c b/common/src/tx_queue_performance_info_get.c index 74d40f11..4bdb62e6 100644 --- a/common/src/tx_queue_performance_info_get.c +++ b/common/src/tx_queue_performance_info_get.c @@ -95,15 +95,15 @@ UINT status; /* Determine if this is a legal request. */ if (queue_ptr == TX_NULL) { - + /* Queue pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the queue ID is invalid. */ else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID) { - + /* Queue pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -125,45 +125,45 @@ UINT status; /* Retrieve the number of messages sent to this queue. */ if (messages_sent != TX_NULL) { - + *messages_sent = queue_ptr -> tx_queue_performance_messages_sent_count; } - + /* Retrieve the number of messages received from this queue. */ if (messages_received != TX_NULL) { - + *messages_received = queue_ptr -> tx_queue_performance_messages_received_count; } - + /* Retrieve the number of empty queue suspensions on this queue. */ if (empty_suspensions != TX_NULL) { - + *empty_suspensions = queue_ptr -> tx_queue_performance_empty_suspension_count; } - + /* Retrieve the number of full queue suspensions on this queue. */ if (full_suspensions != TX_NULL) { - + *full_suspensions = queue_ptr -> tx_queue_performance_full_suspension_count; } - + /* Retrieve the number of full errors (no suspension!) on this queue. */ if (full_errors != TX_NULL) { - + *full_errors = queue_ptr -> tx_queue_performance_full_error_count; } - + /* Retrieve the number of timeouts on this queue. */ if (timeouts != TX_NULL) { - + *timeouts = queue_ptr -> tx_queue_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_queue_performance_system_info_get.c b/common/src/tx_queue_performance_system_info_get.c index 6846d3cc..0299d068 100644 --- a/common/src/tx_queue_performance_system_info_get.c +++ b/common/src/tx_queue_performance_system_info_get.c @@ -106,51 +106,51 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of queue messages sent. */ if (messages_sent != TX_NULL) { - + *messages_sent = _tx_queue_performance_messages_sent_count; } - + /* Retrieve the total number of queue messages received. */ if (messages_received != TX_NULL) { - + *messages_received = _tx_queue_performance__messages_received_count; } - + /* Retrieve the total number of empty queue suspensions. */ if (empty_suspensions != TX_NULL) { - + *empty_suspensions = _tx_queue_performance_empty_suspension_count; } - + /* Retrieve the total number of full queue suspensions. */ if (full_suspensions != TX_NULL) { - + *full_suspensions = _tx_queue_performance_full_suspension_count; } - + /* Retrieve the total number of full errors. */ if (full_errors != TX_NULL) { - + *full_errors = _tx_queue_performance_full_error_count; } - + /* Retrieve the total number of queue timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_queue_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; diff --git a/common/src/tx_queue_prioritize.c b/common/src/tx_queue_prioritize.c index 0768aa02..ae80ce79 100644 --- a/common/src/tx_queue_prioritize.c +++ b/common/src/tx_queue_prioritize.c @@ -161,28 +161,28 @@ UINT list_changed; /* Disable interrupts again. */ TX_DISABLE - /* Determine if any changes to the list have occurred while + /* Determine if any changes to the list have occurred while interrupts were enabled. */ - + /* Is the list head the same? */ if (head_ptr != queue_ptr -> tx_queue_suspension_list) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } else { - + /* Is the suspended count the same? */ if (suspended_count != queue_ptr -> tx_queue_suspended_count) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } } - + /* Determine if the list has changed. */ if (list_changed == TX_FALSE) { @@ -212,12 +212,12 @@ UINT list_changed; /* Release preemption. */ _tx_thread_preempt_disable--; - /* Now determine if the highest priority thread is at the front + /* Now determine if the highest priority thread is at the front of the list. */ if (priority_thread_ptr != head_ptr) { - /* No, we need to move the highest priority suspended thread to the + /* No, we need to move the highest priority suspended thread to the front of the list. */ /* First, remove the highest priority thread by updating the diff --git a/common/src/tx_queue_receive.c b/common/src/tx_queue_receive.c index 3cb2ea5a..40568812 100644 --- a/common/src/tx_queue_receive.c +++ b/common/src/tx_queue_receive.c @@ -118,7 +118,7 @@ UINT status; /* Pickup the thread suspension count. */ suspended_count = queue_ptr -> tx_queue_suspended_count; - + /* Determine if there is anything in the queue. */ if (queue_ptr -> tx_queue_enqueued != TX_NO_MESSAGES) { @@ -128,13 +128,13 @@ UINT status; { /* There is a message waiting in the queue and there are no suspensi. */ - + /* Setup source and destination pointers. */ source = queue_ptr -> tx_queue_read; destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr); size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -145,10 +145,10 @@ UINT status; /* Yes, wrap around to the beginning. */ source = queue_ptr -> tx_queue_start; } - + /* Setup the queue read pointer. */ queue_ptr -> tx_queue_read = source; - + /* Increase the amount of available storage. */ queue_ptr -> tx_queue_available_storage++; @@ -160,18 +160,18 @@ UINT status; } else { - + /* At this point we know the queue is full. */ /* Pickup thread suspension list head pointer. */ thread_ptr = queue_ptr -> tx_queue_suspension_list; /* Now determine if there is a queue front suspension active. */ - + /* Is the front suspension flag set? */ if (thread_ptr -> tx_thread_suspend_option == TX_TRUE) { - + /* Yes, a queue front suspension is present. */ /* Return the message associated with this suspension. */ @@ -181,11 +181,11 @@ UINT status; destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr); size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) - /* Message is now in the caller's destination. See if this is the only suspended thread + /* Message is now in the caller's destination. See if this is the only suspended thread on the list. */ suspended_count--; if (suspended_count == TX_NO_SUSPENSIONS) @@ -244,7 +244,7 @@ UINT status; else { - /* At this point, we know that the queue is full and there + /* At this point, we know that the queue is full and there are one or more threads suspended trying to send another message to this queue. */ @@ -253,7 +253,7 @@ UINT status; destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr); size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -267,7 +267,7 @@ UINT status; /* Setup the queue read pointer. */ queue_ptr -> tx_queue_read = source; - + /* Disable preemption. */ _tx_thread_preempt_disable++; @@ -291,14 +291,14 @@ UINT status; destination = queue_ptr -> tx_queue_write; size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) /* Determine if we are at the end. */ if (destination == queue_ptr -> tx_queue_end) { - + /* Yes, wrap around to the beginning. */ destination = queue_ptr -> tx_queue_start; } @@ -309,7 +309,7 @@ UINT status; /* Pickup thread pointer. */ thread_ptr = queue_ptr -> tx_queue_suspension_list; - /* Message is now in the queue. See if this is the only suspended thread + /* Message is now in the queue. See if this is the only suspended thread on the list. */ suspended_count--; if (suspended_count == TX_NO_SUSPENSIONS) @@ -378,7 +378,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Suspension is not allowed if the preempt disable flag is non-zero at this point - return error completion. */ status = TX_QUEUE_EMPTY; } @@ -395,7 +395,7 @@ UINT status; /* Increment the number of empty suspensions on this queue. */ queue_ptr -> tx_queue_performance_empty_suspension_count++; #endif - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) @@ -477,7 +477,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Immediate return, return error completion. */ status = TX_QUEUE_EMPTY; } diff --git a/common/src/tx_queue_send.c b/common/src/tx_queue_send.c index bdf60b97..7cbb9b73 100644 --- a/common/src/tx_queue_send.c +++ b/common/src/tx_queue_send.c @@ -81,7 +81,7 @@ UINT _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option) { TX_INTERRUPT_SAVE_AREA - + TX_THREAD *thread_ptr; ULONG *source; ULONG *destination; @@ -128,9 +128,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Determine if there are suspended on this queue. */ if (suspended_count == TX_NO_SUSPENSIONS) { - + /* No suspended threads, simply place the message in the queue. */ - + /* Reduce the amount of available storage. */ queue_ptr -> tx_queue_available_storage--; @@ -142,7 +142,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); destination = queue_ptr -> tx_queue_write; size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -182,7 +182,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); else { - /* There is a thread suspended on an empty queue. Simply + /* There is a thread suspended on an empty queue. Simply copy the message to the suspended thread's destination pointer. */ @@ -230,7 +230,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); size = queue_ptr -> tx_queue_message_size; - /* Copy message. Note that the source and destination pointers are + /* Copy message. Note that the source and destination pointers are incremented by the macro. */ TX_QUEUE_MESSAGE_COPY(source, destination, size) @@ -274,7 +274,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); #endif } } - + /* At this point, the queue is full. Determine if suspension is requested. */ else if (wait_option != TX_NO_WAIT) { @@ -302,7 +302,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Increment the number of full suspensions on this queue. */ queue_ptr -> tx_queue_performance_full_suspension_count++; #endif - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) diff --git a/common/src/tx_semaphore_cleanup.c b/common/src/tx_semaphore_cleanup.c index abe23046..bb0f98f5 100644 --- a/common/src/tx_semaphore_cleanup.c +++ b/common/src/tx_semaphore_cleanup.c @@ -87,7 +87,7 @@ UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; - + #ifndef TX_NOT_INTERRUPTABLE @@ -97,7 +97,7 @@ TX_THREAD *previous_thread; /* Determine if the cleanup is still required. */ if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_semaphore_cleanup)) { - + /* Check for valid suspension sequence. */ if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence) { @@ -121,7 +121,7 @@ TX_THREAD *previous_thread; /* Setup pointer to semaphore control block. */ semaphore_ptr = TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block); #endif - + /* Yes, we still have thread suspension! */ /* Clear the suspension cleanup flag. */ @@ -140,7 +140,7 @@ TX_THREAD *previous_thread; { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ semaphore_ptr -> tx_semaphore_suspension_list = TX_NULL; } @@ -154,7 +154,7 @@ TX_THREAD *previous_thread; previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - + /* Determine if we need to update the head pointer. */ if (semaphore_ptr -> tx_semaphore_suspension_list == thread_ptr) { diff --git a/common/src/tx_semaphore_create.c b/common/src/tx_semaphore_create.c index 028dcab0..31527d3a 100644 --- a/common/src/tx_semaphore_create.c +++ b/common/src/tx_semaphore_create.c @@ -87,7 +87,7 @@ TX_SEMAPHORE *previous_semaphore; /* Setup the basic semaphore fields. */ semaphore_ptr -> tx_semaphore_name = name_ptr; semaphore_ptr -> tx_semaphore_count = initial_count; - + /* Disable interrupts to place the semaphore on the created list. */ TX_DISABLE @@ -119,7 +119,7 @@ TX_SEMAPHORE *previous_semaphore; semaphore_ptr -> tx_semaphore_created_previous = previous_semaphore; semaphore_ptr -> tx_semaphore_created_next = next_semaphore; } - + /* Increment the created count. */ _tx_semaphore_created_count++; diff --git a/common/src/tx_semaphore_delete.c b/common/src/tx_semaphore_delete.c index 857a0fc5..0a735474 100644 --- a/common/src/tx_semaphore_delete.c +++ b/common/src/tx_semaphore_delete.c @@ -126,7 +126,7 @@ TX_SEMAPHORE *previous_semaphore; /* See if we have to update the created list head pointer. */ if (_tx_semaphore_created_ptr == semaphore_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_semaphore_created_ptr = next_semaphore; } @@ -148,14 +148,14 @@ TX_SEMAPHORE *previous_semaphore; on this semaphore. */ while (suspended_count != TX_NO_SUSPENSIONS) { - + /* Decrement the suspension count. */ suspended_count--; /* Lockout interrupts. */ TX_DISABLE - /* Clear the cleanup pointer, this prevents the timeout from doing + /* Clear the cleanup pointer, this prevents the timeout from doing anything. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; @@ -179,7 +179,7 @@ TX_SEMAPHORE *previous_semaphore; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread. */ _tx_thread_system_resume(thread_ptr); #endif diff --git a/common/src/tx_semaphore_get.c b/common/src/tx_semaphore_get.c index ff5dd93b..7a0a6e13 100644 --- a/common/src/tx_semaphore_get.c +++ b/common/src/tx_semaphore_get.c @@ -77,7 +77,7 @@ UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option) { TX_INTERRUPT_SAVE_AREA - + TX_THREAD *thread_ptr; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -123,7 +123,7 @@ UINT status; /* Determine if the preempt disable flag is non-zero. */ if (_tx_thread_preempt_disable != ((UINT) 0)) { - + /* Restore interrupts. */ TX_RESTORE @@ -143,7 +143,7 @@ UINT status; /* Increment the number of suspensions on this semaphore. */ semaphore_ptr -> tx_semaphore_performance_suspension_count++; #endif - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) diff --git a/common/src/tx_semaphore_info_get.c b/common/src/tx_semaphore_info_get.c index 8ca99ef3..e79ae662 100644 --- a/common/src/tx_semaphore_info_get.c +++ b/common/src/tx_semaphore_info_get.c @@ -77,8 +77,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore) { @@ -100,38 +100,38 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the semaphore. */ if (name != TX_NULL) { - + *name = semaphore_ptr -> tx_semaphore_name; } - + /* Retrieve the current value of the semaphore. */ if (current_value != TX_NULL) { - + *current_value = semaphore_ptr -> tx_semaphore_count; } - + /* Retrieve the first thread suspended on this semaphore. */ if (first_suspended != TX_NULL) { - + *first_suspended = semaphore_ptr -> tx_semaphore_suspension_list; } - + /* Retrieve the number of threads suspended on this semaphore. */ if (suspended_count != TX_NULL) { - + *suspended_count = (ULONG) semaphore_ptr -> tx_semaphore_suspended_count; } - + /* Retrieve the pointer to the next semaphore created. */ if (next_semaphore != TX_NULL) { - + *next_semaphore = semaphore_ptr -> tx_semaphore_created_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_semaphore_performance_info_get.c b/common/src/tx_semaphore_performance_info_get.c index 5e792e95..29e2b5a3 100644 --- a/common/src/tx_semaphore_performance_info_get.c +++ b/common/src/tx_semaphore_performance_info_get.c @@ -93,15 +93,15 @@ UINT status; /* Determine if this is a legal request. */ if (semaphore_ptr == TX_NULL) { - + /* Semaphore pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the semaphore ID is invalid. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { - + /* Semaphore pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -123,31 +123,31 @@ UINT status; /* Retrieve the number of puts on this semaphore. */ if (puts != TX_NULL) { - + *puts = semaphore_ptr -> tx_semaphore_performance_put_count; } - + /* Retrieve the number of gets on this semaphore. */ if (gets != TX_NULL) { - + *gets = semaphore_ptr -> tx_semaphore_performance_get_count; } - + /* Retrieve the number of suspensions on this semaphore. */ if (suspensions != TX_NULL) { - + *suspensions = semaphore_ptr -> tx_semaphore_performance_suspension_count; } - + /* Retrieve the number of timeouts on this semaphore. */ if (timeouts != TX_NULL) { - + *timeouts = semaphore_ptr -> tx_semaphore_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE @@ -161,37 +161,37 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (semaphore_ptr != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (puts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (gets != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_semaphore_performance_system_info_get.c b/common/src/tx_semaphore_performance_system_info_get.c index 4bdb0d19..fb63710d 100644 --- a/common/src/tx_semaphore_performance_system_info_get.c +++ b/common/src/tx_semaphore_performance_system_info_get.c @@ -101,37 +101,37 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of semaphore puts. */ if (puts != TX_NULL) { - + *puts = _tx_semaphore_performance_put_count; } - + /* Retrieve the total number of semaphore gets. */ if (gets != TX_NULL) { - + *gets = _tx_semaphore_performance_get_count; } - + /* Retrieve the total number of semaphore suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_semaphore_performance_suspension_count; } - + /* Retrieve the total number of semaphore timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_semaphore_performance_timeout_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -140,31 +140,31 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (puts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (gets != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_semaphore_prioritize.c b/common/src/tx_semaphore_prioritize.c index de20e1f8..a7f8e40d 100644 --- a/common/src/tx_semaphore_prioritize.c +++ b/common/src/tx_semaphore_prioritize.c @@ -161,28 +161,28 @@ UINT list_changed; /* Disable interrupts again. */ TX_DISABLE - /* Determine if any changes to the list have occurred while + /* Determine if any changes to the list have occurred while interrupts were enabled. */ - + /* Is the list head the same? */ if (head_ptr != semaphore_ptr -> tx_semaphore_suspension_list) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } else { - + /* Is the suspended count the same? */ if (suspended_count != semaphore_ptr -> tx_semaphore_suspended_count) { - + /* The list head has changed, set the list changed flag. */ list_changed = TX_TRUE; } } - + /* Determine if the list has changed. */ if (list_changed == TX_FALSE) { @@ -214,12 +214,12 @@ UINT list_changed; /* Release preemption. */ _tx_thread_preempt_disable--; - /* Now determine if the highest priority thread is at the front + /* Now determine if the highest priority thread is at the front of the list. */ if (priority_thread_ptr != head_ptr) { - /* No, we need to move the highest priority suspended thread to the + /* No, we need to move the highest priority suspended thread to the front of the list. */ /* First, remove the highest priority thread by updating the diff --git a/common/src/tx_semaphore_put.c b/common/src/tx_semaphore_put.c index dbd973df..53db1a8b 100644 --- a/common/src/tx_semaphore_put.c +++ b/common/src/tx_semaphore_put.c @@ -139,7 +139,7 @@ TX_THREAD *previous_thread; { /* A thread is suspended on this semaphore. */ - + /* Pickup the pointer to the first suspended thread. */ thread_ptr = semaphore_ptr -> tx_semaphore_suspension_list; diff --git a/common/src/tx_thread_create.c b/common/src/tx_thread_create.c index 9ed58320..fc8873d4 100644 --- a/common/src/tx_thread_create.c +++ b/common/src/tx_thread_create.c @@ -118,7 +118,7 @@ ALIGN_TYPE updated_stack_start; #ifdef TX_ENABLE_STACK_CHECKING - /* Ensure that there are two ULONG of 0xEF patterns at the top and + /* Ensure that there are two ULONG of 0xEF patterns at the top and bottom of the thread's stack. This will be used to check for stack overflow conditions during run-time. */ stack_size = ((stack_size/(sizeof(ULONG))) * (sizeof(ULONG))) - (sizeof(ULONG)); @@ -134,7 +134,7 @@ ALIGN_TYPE updated_stack_start; /* Determine if the starting stack address is different. */ if (new_stack_start != updated_stack_start) { - + /* Yes, subtract another ULONG from the size to avoid going past the stack area. */ stack_size = stack_size - (sizeof(ULONG)); } @@ -204,7 +204,7 @@ ALIGN_TYPE updated_stack_start; /* Perform any additional thread setup activities for tool or user purpose. */ TX_THREAD_CREATE_INTERNAL_EXTENSION(thread_ptr) - /* 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. */ _tx_thread_stack_build(thread_ptr, _tx_thread_shell_entry); @@ -246,7 +246,7 @@ ALIGN_TYPE updated_stack_start; thread_ptr -> tx_thread_created_previous = previous_thread; thread_ptr -> tx_thread_created_next = next_thread; } - + /* Increment the thread created count. */ _tx_thread_created_count++; @@ -280,22 +280,22 @@ ALIGN_TYPE updated_stack_start; /* Yes, this create call was made from initialization. */ /* Pickup the current thread execute pointer, which corresponds to the - highest priority thread ready to execute. Interrupt lockout is - not required, since interrupts are assumed to be disabled during + highest priority thread ready to execute. Interrupt lockout is + not required, since interrupts are assumed to be disabled during initialization. */ saved_thread_ptr = _tx_thread_execute_ptr; /* Determine if there is thread ready for execution. */ if (saved_thread_ptr != TX_NULL) { - + /* Yes, a thread is ready for execution when initialization completes. */ /* Save the current preemption-threshold. */ saved_threshold = saved_thread_ptr -> tx_thread_preempt_threshold; - /* For initialization, temporarily set the preemption-threshold to the - priority level to make sure the highest-priority thread runs once + /* For initialization, temporarily set the preemption-threshold to the + priority level to make sure the highest-priority thread runs once initialization is complete. */ saved_thread_ptr -> tx_thread_preempt_threshold = saved_thread_ptr -> tx_thread_priority; } @@ -328,7 +328,7 @@ ALIGN_TYPE updated_stack_start; /* Call the resume thread function to make this thread ready. */ _tx_thread_system_resume(thread_ptr); #endif - + /* Determine if the thread's preemption-threshold needs to be restored. */ if (saved_thread_ptr != TX_NULL) { diff --git a/common/src/tx_thread_delete.c b/common/src/tx_thread_delete.c index a3a5572b..eaa3aa62 100644 --- a/common/src/tx_thread_delete.c +++ b/common/src/tx_thread_delete.c @@ -83,7 +83,7 @@ UINT status; /* Default status to success. */ status = TX_SUCCESS; - + /* Lockout interrupts while the thread is being deleted. */ TX_DISABLE @@ -106,7 +106,7 @@ UINT status; /* Determine if the delete operation is okay. */ if (status == TX_SUCCESS) { - + /* Yes, continue with deleting the thread. */ /* Perform any additional activities for tool or user purpose. */ @@ -129,7 +129,7 @@ UINT status; /* Decrement the number of created threads. */ _tx_thread_created_count--; - + /* See if the thread is the only one on the list. */ if (_tx_thread_created_count == TX_EMPTY) { @@ -149,7 +149,7 @@ UINT status; /* See if we have to update the created list head pointer. */ if (_tx_thread_created_ptr == thread_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_thread_created_ptr = next_thread; } diff --git a/common/src/tx_thread_identify.c b/common/src/tx_thread_identify.c index 80145a0f..2b833b97 100644 --- a/common/src/tx_thread_identify.c +++ b/common/src/tx_thread_identify.c @@ -80,7 +80,7 @@ TX_THREAD *thread_ptr; TX_INTERRUPT_SAVE_AREA - + /* Disable interrupts to put the timer on the created list. */ TX_DISABLE diff --git a/common/src/tx_thread_info_get.c b/common/src/tx_thread_info_get.c index 2597050d..d12c0dcc 100644 --- a/common/src/tx_thread_info_get.c +++ b/common/src/tx_thread_info_get.c @@ -80,8 +80,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, - UINT *priority, UINT *preemption_threshold, ULONG *time_slice, +UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, + UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread) { @@ -103,59 +103,59 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the name of the thread. */ if (name != TX_NULL) { - + *name = thread_ptr -> tx_thread_name; } - + /* Pickup the thread's current state. */ if (state != TX_NULL) { - + *state = thread_ptr -> tx_thread_state; } - + /* Pickup the number of times the thread has been scheduled. */ if (run_count != TX_NULL) { - + *run_count = thread_ptr -> tx_thread_run_count; } - + /* Pickup the thread's priority. */ if (priority != TX_NULL) { - + *priority = thread_ptr -> tx_thread_user_priority; } - + /* Pickup the thread's preemption-threshold. */ if (preemption_threshold != TX_NULL) { - + *preemption_threshold = thread_ptr -> tx_thread_user_preempt_threshold; } - + /* Pickup the thread's current time-slice. */ if (time_slice != TX_NULL) { - + *time_slice = thread_ptr -> tx_thread_time_slice; } - + /* Pickup the next created thread. */ if (next_thread != TX_NULL) { - + *next_thread = thread_ptr -> tx_thread_created_next; } - + /* Pickup the next thread suspended. */ if (next_suspended_thread != TX_NULL) { - + *next_suspended_thread = thread_ptr -> tx_thread_suspended_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_thread_initialize.c b/common/src/tx_thread_initialize.c index 669805c3..578e497d 100644 --- a/common/src/tx_thread_initialize.c +++ b/common/src/tx_thread_initialize.c @@ -175,7 +175,7 @@ VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_ptr); ULONG _tx_build_options; -#ifdef TX_ENABLE_STACK_CHECKING +#if defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) /* Define the global function pointer for stack error handling. If a stack error is detected and the application has registered a stack error handler, it will be @@ -277,7 +277,7 @@ const CHAR _tx_thread_special_string[] = /* FUNCTION RELEASE */ /* */ /* _tx_thread_initialize PORTABLE C */ -/* 6.1 */ +/* 6.1.9 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -312,7 +312,10 @@ const CHAR _tx_thread_special_string[] = /* resulting in version 6.1 */ /* 06-02-2021 Yuxin Zhou Modified comment(s), added */ /* Execution Profile support, */ -/* resulting in version 6.1.7 */ +/* resulting in version 6.1.7 */ +/* 10-15-2021 Yuxin Zhou Modified comment(s), improved */ +/* stack check error handling, */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ VOID _tx_thread_initialize(VOID) diff --git a/common/src/tx_thread_performance_info_get.c b/common/src/tx_thread_performance_info_get.c index f61ed3d8..737e1611 100644 --- a/common/src/tx_thread_performance_info_get.c +++ b/common/src/tx_thread_performance_info_get.c @@ -97,7 +97,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, +UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by) { @@ -111,15 +111,15 @@ UINT status; /* Determine if this is a legal request. */ if (thread_ptr == TX_NULL) { - + /* Thread pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the thread ID is invalid. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { - + /* Thread pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -141,73 +141,73 @@ UINT status; /* Retrieve number of resumptions for this thread. */ if (resumptions != TX_NULL) { - + *resumptions = thread_ptr -> tx_thread_performance_resume_count; } - + /* Retrieve number of suspensions for this thread. */ if (suspensions != TX_NULL) { - + *suspensions = thread_ptr -> tx_thread_performance_suspend_count; } - + /* Retrieve number of solicited preemptions for this thread. */ if (solicited_preemptions != TX_NULL) { - + *solicited_preemptions = thread_ptr -> tx_thread_performance_solicited_preemption_count; } - + /* Retrieve number of interrupt preemptions for this thread. */ if (interrupt_preemptions != TX_NULL) { - + *interrupt_preemptions = thread_ptr -> tx_thread_performance_interrupt_preemption_count; } - + /* Retrieve number of priority inversions for this thread. */ if (priority_inversions != TX_NULL) { - + *priority_inversions = thread_ptr -> tx_thread_performance_priority_inversion_count; } - + /* Retrieve number of time-slices for this thread. */ if (time_slices != TX_NULL) { - + *time_slices = thread_ptr -> tx_thread_performance_time_slice_count; } - + /* Retrieve number of relinquishes for this thread. */ if (relinquishes != TX_NULL) { - + *relinquishes = thread_ptr -> tx_thread_performance_relinquish_count; } - + /* Retrieve number of timeouts for this thread. */ if (timeouts != TX_NULL) { - + *timeouts = thread_ptr -> tx_thread_performance_timeout_count; } - + /* Retrieve number of wait aborts for this thread. */ if (wait_aborts != TX_NULL) { - + *wait_aborts = thread_ptr -> tx_thread_performance_wait_abort_count; } - + /* Retrieve the pointer of the last thread that preempted this thread. */ if (last_preempted_by != TX_NULL) { - + *last_preempted_by = thread_ptr -> tx_thread_performance_last_preempting_thread; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_thread_performance_system_info_get.c b/common/src/tx_thread_performance_system_info_get.c index c027ea1b..8c0afb43 100644 --- a/common/src/tx_thread_performance_system_info_get.c +++ b/common/src/tx_thread_performance_system_info_get.c @@ -123,86 +123,86 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve total number of thread resumptions. */ if (resumptions != TX_NULL) { - + *resumptions = _tx_thread_performance_resume_count; } - + /* Retrieve total number of thread suspensions. */ if (suspensions != TX_NULL) { - + *suspensions = _tx_thread_performance_suspend_count; } - + /* Retrieve total number of solicited thread preemptions. */ if (solicited_preemptions != TX_NULL) { - + *solicited_preemptions = _tx_thread_performance_solicited_preemption_count; } - + /* Retrieve total number of interrupt thread preemptions. */ if (interrupt_preemptions != TX_NULL) { - + *interrupt_preemptions = _tx_thread_performance_interrupt_preemption_count; } - + /* Retrieve total number of thread priority inversions. */ if (priority_inversions != TX_NULL) { - + *priority_inversions = _tx_thread_performance_priority_inversion_count; } - + /* Retrieve total number of thread time-slices. */ if (time_slices != TX_NULL) { - + *time_slices = _tx_thread_performance_time_slice_count; } - + /* Retrieve total number of thread relinquishes. */ if (relinquishes != TX_NULL) { - + *relinquishes = _tx_thread_performance_relinquish_count; } - + /* Retrieve total number of thread timeouts. */ if (timeouts != TX_NULL) { - + *timeouts = _tx_thread_performance_timeout_count; } - + /* Retrieve total number of thread wait aborts. */ if (wait_aborts != TX_NULL) { - + *wait_aborts = _tx_thread_performance_wait_abort_count; } - + /* Retrieve total number of thread non-idle system returns. */ if (non_idle_returns != TX_NULL) { - + *non_idle_returns = _tx_thread_performance_non_idle_return_count; } - + /* Retrieve total number of thread idle system returns. */ if (idle_returns != TX_NULL) { - + *idle_returns = _tx_thread_performance_idle_return_count; } - + /* Restore interrupts. */ TX_RESTORE /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -211,73 +211,73 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (resumptions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (suspensions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (solicited_preemptions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (interrupt_preemptions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (priority_inversions != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (time_slices != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (relinquishes != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (timeouts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (wait_aborts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (non_idle_returns != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (idle_returns != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_thread_preemption_change.c b/common/src/tx_thread_preemption_change.c index 9b323e2b..3d00793f 100644 --- a/common/src/tx_thread_preemption_change.c +++ b/common/src/tx_thread_preemption_change.c @@ -93,16 +93,16 @@ UINT status; #ifdef TX_DISABLE_PREEMPTION_THRESHOLD - /* Only allow 0 (disable all preemption) and returning preemption-threshold to the + /* Only allow 0 (disable all preemption) and returning preemption-threshold to the current thread priority if preemption-threshold is disabled. All other threshold values are converted to 0. */ if (thread_ptr -> tx_thread_user_priority != new_threshold) { - + /* Is the new threshold zero? */ if (new_threshold != ((UINT) 0)) { - + /* Convert the new threshold to disable all preemption, since preemption-threshold is not supported. */ new_threshold = ((UINT) 0); @@ -122,7 +122,7 @@ UINT status; /* Determine if the new threshold is greater than the current user priority. */ if (new_threshold > thread_ptr -> tx_thread_user_priority) { - + /* Return error. */ status = TX_THRESH_ERROR; } @@ -174,13 +174,13 @@ UINT status; /* Determine if the new threshold represents a higher priority than the priority inheritance threshold. */ if (new_threshold < thread_ptr -> tx_thread_inherit_priority) { - + /* Update the actual preemption-threshold with the new threshold. */ thread_ptr -> tx_thread_preempt_threshold = new_threshold; } else { - + /* Update the actual preemption-threshold with the priority inheritance. */ thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_inherit_priority; } @@ -240,18 +240,18 @@ UINT status; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -265,7 +265,7 @@ UINT status; /* Check for preemption. */ _tx_thread_system_preempt_check(); - + /* Disable interrupts. */ TX_DISABLE } @@ -275,7 +275,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Return completion status. */ return(status); } diff --git a/common/src/tx_thread_priority_change.c b/common/src/tx_thread_priority_change.c index 967867b1..06b9391e 100644 --- a/common/src/tx_thread_priority_change.c +++ b/common/src/tx_thread_priority_change.c @@ -116,19 +116,19 @@ UINT original_priority; block. */ thread_ptr -> tx_thread_user_priority = new_priority; thread_ptr -> tx_thread_user_preempt_threshold = new_priority; - + /* Determine if the actual thread priority should be setup, which is the case if the new priority is higher than the priority inheritance. */ if (new_priority < thread_ptr -> tx_thread_inherit_priority) { - + /* Change thread priority to the new user's priority. */ thread_ptr -> tx_thread_priority = new_priority; thread_ptr -> tx_thread_preempt_threshold = new_priority; } else { - + /* Change thread priority to the priority inheritance. */ thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_inherit_priority; thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_inherit_priority; @@ -157,7 +157,7 @@ UINT original_priority; /* Call actual non-interruptable thread suspension routine. */ _tx_thread_system_ni_suspend(thread_ptr, ((ULONG) 0)); - /* At this point, the preempt disable flag is still set, so we still have + /* At this point, the preempt disable flag is still set, so we still have protection against all preemption. */ /* Setup the new priority for this thread. */ @@ -168,14 +168,14 @@ UINT original_priority; case if the new priority is higher than the priority inheritance. */ if (new_priority < thread_ptr -> tx_thread_inherit_priority) { - + /* Change thread priority to the new user's priority. */ thread_ptr -> tx_thread_priority = new_priority; thread_ptr -> tx_thread_preempt_threshold = new_priority; } else { - + /* Change thread priority to the priority inheritance. */ thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_inherit_priority; thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_inherit_priority; @@ -186,7 +186,7 @@ UINT original_priority; #else - /* Increment the preempt disable flag by 2 to prevent system suspend from + /* Increment the preempt disable flag by 2 to prevent system suspend from returning to the system. */ _tx_thread_preempt_disable = _tx_thread_preempt_disable + ((UINT) 3); @@ -199,11 +199,11 @@ UINT original_priority; /* Restore interrupts. */ TX_RESTORE - /* The thread is ready and must first be removed from the list. Call the + /* The thread is ready and must first be removed from the list. Call the system suspend function to accomplish this. */ _tx_thread_system_suspend(thread_ptr); - /* At this point, the preempt disable flag is still set, so we still have + /* At this point, the preempt disable flag is still set, so we still have protection against all preemption. */ /* Setup the new priority for this thread. */ @@ -214,14 +214,14 @@ UINT original_priority; case if the new priority is higher than the priority inheritance. */ if (new_priority < thread_ptr -> tx_thread_inherit_priority) { - + /* Change thread priority to the new user's priority. */ thread_ptr -> tx_thread_priority = new_priority; thread_ptr -> tx_thread_preempt_threshold = new_priority; } else { - + /* Change thread priority to the priority inheritance. */ thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_inherit_priority; thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_inherit_priority; @@ -236,26 +236,26 @@ UINT original_priority; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Pickup the next thread to execute. */ next_execute_ptr = _tx_thread_execute_ptr; /* Determine if this thread is not the next thread to execute. */ if (thread_ptr != next_execute_ptr) { - + /* Make sure the thread is still ready. */ if (thread_ptr -> tx_thread_state == TX_READY) { - + /* Now check and see if this thread has an equal or higher priority. */ if (thread_ptr -> tx_thread_priority <= next_execute_ptr -> tx_thread_priority) { - + /* Now determine if this thread was the previously executing thread. */ if (thread_ptr == execute_ptr) { - + /* Yes, this thread was previously executing before we temporarily suspended and resumed it in order to change the priority. A lower or same priority thread cannot be the next thread to execute in this case since this thread really didn't suspend. Simply reset the execute @@ -265,7 +265,7 @@ UINT original_priority; /* Determine if we moved to a lower priority. If so, move the thread to the front of its priority list. */ if (original_priority < new_priority) { - + /* Ensure that this thread is placed at the front of the priority list. */ _tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr; } @@ -273,7 +273,7 @@ UINT original_priority; } } } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_thread_relinquish.c b/common/src/tx_thread_relinquish.c index b2606601..f6f6e4bc 100644 --- a/common/src/tx_thread_relinquish.c +++ b/common/src/tx_thread_relinquish.c @@ -112,7 +112,7 @@ TX_THREAD *thread_ptr; /* Yes, there is another thread at this priority, make it the highest at this priority level. */ _tx_thread_priority_list[priority] = thread_ptr -> tx_thread_ready_next; - + /* Mark the new thread as the one to execute. */ _tx_thread_execute_ptr = thread_ptr -> tx_thread_ready_next; } diff --git a/common/src/tx_thread_reset.c b/common/src/tx_thread_reset.c index 6c98c2b1..5fc97e51 100644 --- a/common/src/tx_thread_reset.c +++ b/common/src/tx_thread_reset.c @@ -135,7 +135,7 @@ UINT status; TX_MEMSET(thread_ptr -> tx_thread_stack_start, ((UCHAR) TX_STACK_FILL), thread_ptr -> tx_thread_stack_size); #endif - /* 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. */ _tx_thread_stack_build(thread_ptr, _tx_thread_shell_entry); diff --git a/common/src/tx_thread_resume.c b/common/src/tx_thread_resume.c index bb111592..57174ded 100644 --- a/common/src/tx_thread_resume.c +++ b/common/src/tx_thread_resume.c @@ -128,22 +128,22 @@ UINT map_index; /* Yes, this resume call was made from initialization. */ /* Pickup the current thread execute pointer, which corresponds to the - highest priority thread ready to execute. Interrupt lockout is - not required, since interrupts are assumed to be disabled during + highest priority thread ready to execute. Interrupt lockout is + not required, since interrupts are assumed to be disabled during initialization. */ saved_thread_ptr = _tx_thread_execute_ptr; /* Determine if there is thread ready for execution. */ if (saved_thread_ptr != TX_NULL) { - + /* Yes, a thread is ready for execution when initialization completes. */ /* Save the current preemption-threshold. */ saved_threshold = saved_thread_ptr -> tx_thread_preempt_threshold; - /* For initialization, temporarily set the preemption-threshold to the - priority level to make sure the highest-priority thread runs once + /* For initialization, temporarily set the preemption-threshold to the + priority level to make sure the highest-priority thread runs once initialization is complete. */ saved_thread_ptr -> tx_thread_preempt_threshold = saved_thread_ptr -> tx_thread_priority; } @@ -184,7 +184,7 @@ UINT map_index; can only happen if this routine is called from initialization. */ saved_thread_ptr -> tx_thread_preempt_threshold = saved_threshold; } - + #ifdef TX_MISRA_ENABLE /* Disable interrupts. */ @@ -197,11 +197,11 @@ UINT map_index; /* Return successful completion. */ return(TX_SUCCESS); #endif - - + + #else - /* In-line thread resumption processing follows, which is effectively just taking the + /* In-line thread resumption processing follows, which is effectively just taking the logic in tx_thread_system_resume.c and placing it here! */ /* Resume the thread! */ @@ -211,14 +211,14 @@ UINT map_index; /* If trace is enabled, save the current event pointer. */ entry_ptr = _tx_trace_buffer_current_ptr; #endif - + /* Log the thread status change. */ TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_RESUME, thread_ptr, thread_ptr -> tx_thread_state, TX_POINTER_TO_ULONG_CONVERT(&execute_ptr), TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr), TX_TRACE_INTERNAL_EVENTS) #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -288,7 +288,7 @@ UINT map_index; /* Pickup the execute pointer. Since it is going to be referenced multiple times, it is placed in a local variable. */ execute_ptr = _tx_thread_execute_ptr; - + /* Determine if no thread is currently executing. */ if (execute_ptr == TX_NULL) { @@ -300,7 +300,7 @@ UINT map_index; { /* Another thread has been scheduled for execution. */ - + /* Check to see if this is a higher priority thread and determine if preemption is allowed. */ if (priority < execute_ptr -> tx_thread_preempt_threshold) { @@ -341,7 +341,7 @@ UINT map_index; } else { - + if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS) { @@ -378,18 +378,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -402,11 +402,11 @@ UINT map_index; resume event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to NULL. This can be used by the trace analysis tool to show idle system conditions. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -453,7 +453,7 @@ UINT map_index; { /* No, there are other threads at this priority already ready. */ - + /* Just add this thread to the priority list. */ tail_ptr = head_ptr -> tx_thread_ready_previous; tail_ptr -> tx_thread_ready_next = thread_ptr; @@ -469,18 +469,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -517,7 +517,7 @@ UINT map_index; can only happen if this routine is called from initialization. */ saved_thread_ptr -> tx_thread_preempt_threshold = saved_threshold; } - + /* Setup successful return status. */ status = TX_SUCCESS; #endif diff --git a/common/src/tx_thread_shell_entry.c b/common/src/tx_thread_shell_entry.c index ef106c5c..bec5a12d 100644 --- a/common/src/tx_thread_shell_entry.c +++ b/common/src/tx_thread_shell_entry.c @@ -119,7 +119,7 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type); if (_tx_thread_mutex_release != TX_NULL) { - /* Yes, call the mutex release function via a function pointer that + /* Yes, call the mutex release function via a function pointer that is setup during mutex initialization. */ (_tx_thread_mutex_release)(thread_ptr); } diff --git a/common/src/tx_thread_sleep.c b/common/src/tx_thread_sleep.c index e4b92c57..c908134c 100644 --- a/common/src/tx_thread_sleep.c +++ b/common/src/tx_thread_sleep.c @@ -94,18 +94,18 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Illegal caller of this service. */ status = TX_CALLER_ERROR; } - + /* Is the caller an ISR or Initialization? */ else if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { /* Restore interrupts. */ TX_RESTORE - + /* Illegal caller of this service. */ status = TX_CALLER_ERROR; } @@ -118,7 +118,7 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Illegal caller of this service. */ status = TX_CALLER_ERROR; } @@ -130,7 +130,7 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Just return with a successful status. */ status = TX_SUCCESS; } @@ -143,13 +143,13 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Suspension is not allowed if the preempt disable flag is non-zero at this point - return error completion. */ status = TX_CALLER_ERROR; } else { - + /* If trace is enabled, insert this event into the trace buffer. */ TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_SLEEP, TX_ULONG_TO_POINTER_CONVERT(timer_ticks), thread_ptr -> tx_thread_state, TX_POINTER_TO_ULONG_CONVERT(&status), 0, TX_TRACE_THREAD_EVENTS) @@ -193,7 +193,7 @@ TX_THREAD *thread_ptr; status = thread_ptr -> tx_thread_suspend_status; } } - + /* Return completion status. */ return(status); } diff --git a/common/src/tx_thread_stack_analyze.c b/common/src/tx_thread_stack_analyze.c index 7a75ab30..886e4d9e 100644 --- a/common/src/tx_thread_stack_analyze.c +++ b/common/src/tx_thread_stack_analyze.c @@ -94,7 +94,7 @@ ULONG size; /* Pickup the current stack variables. */ stack_lowest = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_start); - + /* Determine if the pointer is null. */ if (stack_lowest != TX_NULL) { @@ -105,11 +105,11 @@ ULONG size; /* Determine if the pointer is null. */ if (stack_highest != TX_NULL) { - + /* Restore interrupts. */ TX_RESTORE - /* We need to binary search the remaining stack for missing 0xEFEFEFEF 32-bit data pattern. + /* We need to binary search the remaining stack for missing 0xEFEFEFEF 32-bit data pattern. This is a best effort algorithm to find the highest stack usage. */ do { @@ -137,7 +137,7 @@ ULONG size; /* Position to first used word - at this point we are within a few words. */ while (*stack_ptr == TX_STACK_FILL) { - + /* Position to next word in stack. */ stack_ptr = TX_ULONG_POINTER_ADD(stack_ptr, 1); } @@ -153,19 +153,19 @@ ULONG size; { /* Yes, thread is still created. */ - + /* Now check the new highest stack pointer is past the stack start. */ if (stack_ptr > (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_start))) { - + /* Yes, now check that the new highest stack pointer is less than the previous highest stack pointer. */ if (stack_ptr < (TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr))) { - + /* Yes, is the current highest stack pointer pointing at used memory? */ if (*stack_ptr != TX_STACK_FILL) { - + /* Yes, setup the highest stack usage. */ thread_ptr -> tx_thread_stack_highest_ptr = stack_ptr; } diff --git a/common/src/tx_thread_stack_error_handler.c b/common/src/tx_thread_stack_error_handler.c index 9049b338..e1966617 100644 --- a/common/src/tx_thread_stack_error_handler.c +++ b/common/src/tx_thread_stack_error_handler.c @@ -26,8 +26,7 @@ /* Include necessary system files. */ #include "tx_api.h" -#ifndef TX_PORT_THREAD_STACK_ERROR_HANDLER -#if defined(TX_MISRA_ENABLE) || defined(TX_ENABLE_STACK_CHECKING) +#if defined(TX_MISRA_ENABLE) || defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) #include "tx_thread.h" @@ -36,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _tx_thread_stack_error_handler PORTABLE C */ -/* 6.1.7 */ +/* 6.1.9 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,6 +77,9 @@ /* conditional compilation */ /* for ARMv8-M (Cortex M23/33) */ /* resulting in version 6.1.7 */ +/* 10-15-2021 Yuxin Zhou Modified comment(s), improved */ +/* stack check error handling, */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ VOID _tx_thread_stack_error_handler(TX_THREAD *thread_ptr) @@ -85,7 +87,7 @@ VOID _tx_thread_stack_error_handler(TX_THREAD *thread_ptr) TX_INTERRUPT_SAVE_AREA -#ifdef TX_ENABLE_STACK_CHECKING +#if defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) /* Disable interrupts. */ TX_DISABLE @@ -109,12 +111,10 @@ TX_INTERRUPT_SAVE_AREA /* Disable interrupts. */ TX_DISABLE - + /* Restore interrupts. */ TX_RESTORE } #endif } -#endif /* TX_MISRA_ENABLE */ - -#endif /* TX_PORT_THREAD_STACK_ERROR_HANDLER */ +#endif diff --git a/common/src/tx_thread_stack_error_notify.c b/common/src/tx_thread_stack_error_notify.c index 6142bad3..5f481c16 100644 --- a/common/src/tx_thread_stack_error_notify.c +++ b/common/src/tx_thread_stack_error_notify.c @@ -26,9 +26,8 @@ /* Include necessary system files. */ #include "tx_api.h" -#ifndef TX_PORT_THREAD_STACK_ERROR_NOTIFY #include "tx_thread.h" -#ifdef TX_ENABLE_STACK_CHECKING +#if defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) #include "tx_trace.h" #endif @@ -38,7 +37,7 @@ /* FUNCTION RELEASE */ /* */ /* _tx_thread_stack_error_notify PORTABLE C */ -/* 6.1.7 */ +/* 6.1.9 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -79,12 +78,15 @@ /* conditional compilation */ /* for ARMv8-M (Cortex M23/33) */ /* resulting in version 6.1.7 */ +/* 10-15-2021 Yuxin Zhou Modified comment(s), improved */ +/* stack check error handling, */ +/* resulting in version 6.1.9 */ /* */ /**************************************************************************/ UINT _tx_thread_stack_error_notify(VOID (*stack_error_handler)(TX_THREAD *thread_ptr)) { -#ifndef TX_ENABLE_STACK_CHECKING +#if !defined(TX_ENABLE_STACK_CHECKING) && !defined(TX_PORT_THREAD_STACK_ERROR_HANDLING) UINT status; @@ -98,13 +100,14 @@ UINT status; } else { - + /* Stack checking is not enabled, just return an error. */ status = TX_FEATURE_NOT_ENABLED; } /* Return completion status. */ return(status); + #else TX_INTERRUPT_SAVE_AREA @@ -129,5 +132,3 @@ TX_INTERRUPT_SAVE_AREA return(TX_SUCCESS); #endif } - -#endif /* TX_PORT_THREAD_STACK_ERROR_NOTIFY */ diff --git a/common/src/tx_thread_suspend.c b/common/src/tx_thread_suspend.c index dc4fc076..956b1e68 100644 --- a/common/src/tx_thread_suspend.c +++ b/common/src/tx_thread_suspend.c @@ -109,7 +109,7 @@ UINT status; /* Determine if we are in a thread context. */ if (TX_THREAD_GET_SYSTEM_STATE() == ((ULONG) 0)) { - + /* Yes, we are in a thread context. */ /* Determine if the current thread is also the suspending thread. */ @@ -120,13 +120,13 @@ UINT status; if (_tx_thread_preempt_disable != ((UINT) 0)) { - /* Current thread cannot suspend when the preempt disable flag is non-zero, + /* Current thread cannot suspend when the preempt disable flag is non-zero, return an error. */ status = TX_SUSPEND_ERROR; } } } - + /* Determine if the status is still successful. */ if (status == TX_SUCCESS) { @@ -163,7 +163,7 @@ UINT status; /* Disable interrupts. */ TX_DISABLE - + /* Return success. */ status = TX_SUCCESS; #else @@ -204,15 +204,15 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - /* Always return success, since this function does not perform error + /* Always return success, since this function does not perform error checking. */ return(status); - + #else - /* In-line thread suspension processing follows, which is effectively just taking the + /* In-line thread suspension processing follows, which is effectively just taking the logic in tx_thread_system_suspend.c and placing it here! */ - + UINT priority; UINT base_priority; ULONG priority_map; @@ -270,7 +270,7 @@ ULONG time_stamp = ((ULONG) 0); /* Determine if we are in a thread context. */ if (TX_THREAD_GET_SYSTEM_STATE() == ((ULONG) 0)) { - + /* Yes, we are in a thread context. */ /* Determine if the current thread is also the suspending thread. */ @@ -281,19 +281,19 @@ ULONG time_stamp = ((ULONG) 0); if (_tx_thread_preempt_disable != ((UINT) 0)) { - /* Current thread cannot suspend when the preempt disable flag is non-zero, + /* Current thread cannot suspend when the preempt disable flag is non-zero, return an error. */ status = TX_SUSPEND_ERROR; } } } - + /* Determine if the status is still successful. */ if (status == TX_SUCCESS) { #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO - + /* Increment the thread's suspend count. */ thread_ptr -> tx_thread_performance_suspend_count++; @@ -322,7 +322,7 @@ ULONG time_stamp = ((ULONG) 0); #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -391,7 +391,7 @@ ULONG time_stamp = ((ULONG) 0); else { - /* This is the only thread at this priority ready to run. Set the head + /* This is the only thread at this priority ready to run. Set the head pointer to NULL. */ _tx_thread_priority_list[priority] = TX_NULL; @@ -483,13 +483,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = 0; } @@ -521,7 +521,7 @@ ULONG time_stamp = ((ULONG) 0); } else { - + /* Calculate the lowest bit set in the priority map. */ TX_LOWEST_SET_BIT_CALCULATE(priority_map, priority_bit) @@ -529,7 +529,7 @@ ULONG time_stamp = ((ULONG) 0); _tx_thread_highest_priority = base_priority + priority_bit; } } - + /* Determine if this thread is the thread designated to execute. */ if (thread_ptr == _tx_thread_execute_ptr) { @@ -599,7 +599,7 @@ ULONG time_stamp = ((ULONG) 0); if (_tx_thread_highest_priority >= (_tx_thread_priority_list[priority] -> tx_thread_preempt_threshold)) { - /* Thread not allowed to execute until earlier preempted thread finishes or lowers its + /* Thread not allowed to execute until earlier preempted thread finishes or lowers its preemption-threshold. */ _tx_thread_execute_ptr = _tx_thread_priority_list[priority]; @@ -614,9 +614,9 @@ ULONG time_stamp = ((ULONG) 0); /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -636,7 +636,7 @@ ULONG time_stamp = ((ULONG) 0); /* Determine if there are any other bits set in this preempt map. */ if (_tx_thread_preempted_maps[MAP_INDEX] == ((ULONG) 0)) { - + /* No, clear the active bit to signify this preempt map has nothing set. */ TX_DIV32_BIT_SET(priority, priority_bit) _tx_thread_preempted_map_active = _tx_thread_preempted_map_active & (~(priority_bit)); @@ -653,18 +653,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -677,13 +677,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = 0; } @@ -719,18 +719,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -747,9 +747,9 @@ ULONG time_stamp = ((ULONG) 0); /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -798,7 +798,7 @@ ULONG time_stamp = ((ULONG) 0); _tx_thread_performance_non_idle_return_count++; } #endif - + /* Preemption is needed - return to the system! */ _tx_thread_system_return(); } diff --git a/common/src/tx_thread_system_preempt_check.c b/common/src/tx_thread_system_preempt_check.c index 8f1d00a1..9443e4f6 100644 --- a/common/src/tx_thread_system_preempt_check.c +++ b/common/src/tx_thread_system_preempt_check.c @@ -84,7 +84,7 @@ TX_THREAD *thread_ptr; /* Determine if we are in a system state (ISR or Initialization) or internal preemption is disabled. */ if (combined_flags == ((ULONG) 0)) { - + /* No, at thread execution level so continue checking for preemption. */ /* Pickup thread pointer. */ diff --git a/common/src/tx_thread_system_resume.c b/common/src/tx_thread_system_resume.c index 278e9b11..a748e518 100644 --- a/common/src/tx_thread_system_resume.c +++ b/common/src/tx_thread_system_resume.c @@ -140,7 +140,7 @@ UINT map_index; #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -158,7 +158,7 @@ UINT map_index; if (thread_ptr -> tx_thread_suspending == TX_FALSE) { - /* Thread is not in the process of suspending. Now check to make sure the thread + /* Thread is not in the process of suspending. Now check to make sure the thread has not already been resumed. */ if (thread_ptr -> tx_thread_state != TX_READY) { @@ -166,9 +166,9 @@ UINT map_index; /* No, now check to see if the delayed suspension flag is set. */ if (thread_ptr -> tx_thread_delayed_suspend == TX_FALSE) { - + /* Resume the thread! */ - + /* Make this thread ready. */ /* Change the state to ready. */ @@ -229,7 +229,7 @@ UINT map_index; /* Pickup the execute pointer. Since it is going to be referenced multiple times, it is placed in a local variable. */ execute_ptr = _tx_thread_execute_ptr; - + /* Determine if no thread is currently executing. */ if (execute_ptr == TX_NULL) { @@ -239,9 +239,9 @@ UINT map_index; } else { - + /* Another thread has been scheduled for execution. */ - + /* Check to see if this is a higher priority thread and determine if preemption is allowed. */ if (priority < execute_ptr -> tx_thread_preempt_threshold) { @@ -282,7 +282,7 @@ UINT map_index; } else { - + if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS) { @@ -301,7 +301,7 @@ UINT map_index; /* Yes, modify the execute thread pointer. */ _tx_thread_execute_ptr = thread_ptr; - + #ifndef TX_MISRA_ENABLE /* If MISRA is not-enabled, insert a preemption and return in-line for performance. */ @@ -311,18 +311,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -335,11 +335,11 @@ UINT map_index; resume event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to NULL. This can be used by the trace analysis tool to show idle system conditions. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -408,15 +408,15 @@ UINT map_index; } else { - + /* A resumption occurred in the middle of a previous thread suspension. */ - + /* Make sure the type of suspension under way is not a terminate or - thread completion. In either of these cases, do not void the + thread completion. In either of these cases, do not void the interrupted suspension processing. */ if (thread_ptr -> tx_thread_state != TX_COMPLETED) { - + /* Make sure the thread isn't terminated. */ if (thread_ptr -> tx_thread_state != TX_TERMINATED) { @@ -439,7 +439,7 @@ UINT map_index; } else { - + /* Clear the delayed suspend flag and change the state. */ thread_ptr -> tx_thread_delayed_suspend = TX_FALSE; thread_ptr -> tx_thread_state = TX_SUSPENDED; @@ -462,18 +462,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -486,11 +486,11 @@ UINT map_index; resume event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to NULL. This can be used by the trace analysis tool to show idle system conditions. */ #ifdef TX_MISRA_ENABLE @@ -564,7 +564,7 @@ UINT state; } else { - + /* A resumption occurred in the middle of a previous thread suspension. */ /* Pickup the current thread state. */ @@ -575,20 +575,20 @@ UINT state; /* Move the state into a different variable for MISRA compliance. */ temp_state = state; #endif - + /* Log the thread status change. */ TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_RESUME, thread_ptr, ((ULONG) state), TX_POINTER_TO_ULONG_CONVERT(&temp_state), TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr), TX_TRACE_INTERNAL_EVENTS) - + /* Make sure the type of suspension under way is not a terminate or - thread completion. In either of these cases, do not void the + thread completion. In either of these cases, do not void the interrupted suspension processing. */ if (state != TX_COMPLETED) { - + /* Check for terminated thread. */ if (state != TX_TERMINATED) { - + /* Clear the suspending flag. */ thread_ptr -> tx_thread_suspending = TX_FALSE; @@ -653,7 +653,7 @@ UINT map_index; #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -681,7 +681,7 @@ UINT map_index; TX_THREAD_STACK_CHECK(thread_ptr) #endif - /* Thread is not in the process of suspending. Now check to make sure the thread + /* Thread is not in the process of suspending. Now check to make sure the thread has not already been resumed. */ if (thread_ptr -> tx_thread_state != TX_READY) { @@ -752,7 +752,7 @@ UINT map_index; /* Pickup the execute pointer. Since it is going to be referenced multiple times, it is placed in a local variable. */ execute_ptr = _tx_thread_execute_ptr; - + /* Determine if no thread is currently executing. */ if (execute_ptr == TX_NULL) { @@ -762,7 +762,7 @@ UINT map_index; } else { - + /* Check to see if this is a higher priority thread and determine if preemption is allowed. */ if (priority < execute_ptr -> tx_thread_preempt_threshold) { @@ -803,7 +803,7 @@ UINT map_index; } else { - + if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS) { @@ -831,18 +831,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -855,11 +855,11 @@ UINT map_index; resume event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to NULL. This can be used by the trace analysis tool to show idle system conditions. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -903,7 +903,7 @@ UINT map_index; { /* No, there are other threads at this priority already ready. */ - + /* Just add this thread to the priority list. */ tail_ptr = head_ptr -> tx_thread_ready_previous; tail_ptr -> tx_thread_ready_next = thread_ptr; @@ -928,18 +928,18 @@ UINT map_index; /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -952,11 +952,11 @@ UINT map_index; resume event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Does the timestamp match? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to NULL. This can be used by the trace analysis tool to show idle system conditions. */ #ifdef TX_MISRA_ENABLE diff --git a/common/src/tx_thread_system_suspend.c b/common/src/tx_thread_system_suspend.c index 56dc710f..ee3c1edb 100644 --- a/common/src/tx_thread_system_suspend.c +++ b/common/src/tx_thread_system_suspend.c @@ -85,7 +85,7 @@ VOID _tx_thread_system_suspend(TX_THREAD *thread_ptr) { TX_INTERRUPT_SAVE_AREA - + UINT priority; UINT base_priority; ULONG priority_map; @@ -136,7 +136,7 @@ ULONG time_stamp = ((ULONG) 0); /* Make sure the suspension is not a wait-forever. */ if (timeout != TX_WAIT_FOREVER) { - + /* Activate the thread timer with the timeout value setup in the caller. */ _tx_timer_system_activate(&(thread_ptr -> tx_thread_timer)); } @@ -146,7 +146,7 @@ ULONG time_stamp = ((ULONG) 0); _tx_timer_time_slice = thread_ptr -> tx_thread_new_time_slice; } #endif - + /* Decrease the preempt disabled count. */ _tx_thread_preempt_disable--; @@ -182,7 +182,7 @@ ULONG time_stamp = ((ULONG) 0); #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -256,7 +256,7 @@ ULONG time_stamp = ((ULONG) 0); else { - /* This is the only thread at this priority ready to run. Set the head + /* This is the only thread at this priority ready to run. Set the head pointer to NULL. */ _tx_thread_priority_list[priority] = TX_NULL; @@ -348,13 +348,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = 0; } @@ -386,9 +386,9 @@ ULONG time_stamp = ((ULONG) 0); } else { - + /* Other threads at different priority levels are ready to run. */ - + /* Calculate the lowest bit set in the priority map. */ TX_LOWEST_SET_BIT_CALCULATE(priority_map, priority_bit) @@ -463,7 +463,7 @@ ULONG time_stamp = ((ULONG) 0); if (_tx_thread_highest_priority >= (_tx_thread_priority_list[priority] -> tx_thread_preempt_threshold)) { - /* Thread not allowed to execute until earlier preempted thread finishes or lowers its + /* Thread not allowed to execute until earlier preempted thread finishes or lowers its preemption-threshold. */ _tx_thread_execute_ptr = _tx_thread_priority_list[priority]; @@ -476,7 +476,7 @@ ULONG time_stamp = ((ULONG) 0); /* Determine if there are any other bits set in this preempt map. */ if (_tx_thread_preempted_maps[MAP_INDEX] == ((ULONG) 0)) { - + /* No, clear the active bit to signify this preempt map has nothing set. */ TX_DIV32_BIT_SET(priority, priority_bit) _tx_thread_preempted_map_active = _tx_thread_preempted_map_active & (~(priority_bit)); @@ -493,18 +493,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -517,13 +517,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); } @@ -559,18 +559,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -583,13 +583,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); @@ -655,14 +655,14 @@ ULONG time_stamp = ((ULONG) 0); TX_INTERRUPT_SAVE_AREA ULONG wait_option; - + /* Disable interrupts. */ TX_DISABLE /* Determine if the thread is still suspending. */ if (thread_ptr -> tx_thread_suspending == TX_TRUE) { - + /* Yes, prepare to call the non-interruptable system suspend function. */ /* Clear the thread suspending flag. */ @@ -670,7 +670,7 @@ ULONG wait_option; /* Pickup the wait option. */ wait_option = thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks; - + /* Decrement the preempt disable count. */ _tx_thread_preempt_disable--; @@ -690,7 +690,7 @@ ULONG wait_option; VOID _tx_thread_system_ni_suspend(TX_THREAD *thread_ptr, ULONG wait_option) { - + UINT priority; UINT base_priority; ULONG priority_map; @@ -719,7 +719,7 @@ ULONG time_stamp = ((ULONG) 0); /* Determine if a timeout needs to be activated. */ if (thread_ptr == current_thread) { - + /* Is there a wait option? */ if (wait_option != TX_NO_WAIT) { @@ -727,7 +727,7 @@ ULONG time_stamp = ((ULONG) 0); /* Make sure it is not a wait-forever option. */ if (wait_option != TX_WAIT_FOREVER) { - + /* Setup the wait option. */ thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = wait_option; @@ -735,7 +735,7 @@ ULONG time_stamp = ((ULONG) 0); _tx_timer_system_activate(&(thread_ptr -> tx_thread_timer)); } } - + /* Reset time slice for current thread. */ _tx_timer_time_slice = thread_ptr -> tx_thread_new_time_slice; } @@ -774,7 +774,7 @@ ULONG time_stamp = ((ULONG) 0); #ifdef TX_ENABLE_EVENT_TRACE /* Save the time stamp for later comparison to verify that - the event hasn't been overwritten by the time we have + the event hasn't been overwritten by the time we have computed the next thread to execute. */ if (entry_ptr != TX_NULL) { @@ -845,7 +845,7 @@ ULONG time_stamp = ((ULONG) 0); else { - /* This is the only thread at this priority ready to run. Set the head + /* This is the only thread at this priority ready to run. Set the head pointer to NULL. */ _tx_thread_priority_list[priority] = TX_NULL; @@ -937,13 +937,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = 0; } @@ -972,7 +972,7 @@ ULONG time_stamp = ((ULONG) 0); } else { - + /* Calculate the lowest bit set in the priority map. */ TX_LOWEST_SET_BIT_CALCULATE(priority_map, priority_bit) @@ -980,7 +980,7 @@ ULONG time_stamp = ((ULONG) 0); _tx_thread_highest_priority = base_priority + ((UINT) priority_bit); } } - + /* Determine if the suspending thread is the thread designated to execute. */ if (thread_ptr == _tx_thread_execute_ptr) { @@ -1038,7 +1038,7 @@ ULONG time_stamp = ((ULONG) 0); if (_tx_thread_highest_priority >= (_tx_thread_priority_list[priority] -> tx_thread_preempt_threshold)) { - /* Thread not allowed to execute until earlier preempted thread finishes or lowers its + /* Thread not allowed to execute until earlier preempted thread finishes or lowers its preemption-threshold. */ _tx_thread_execute_ptr = _tx_thread_priority_list[priority]; @@ -1051,7 +1051,7 @@ ULONG time_stamp = ((ULONG) 0); /* Determine if there are any other bits set in this preempt map. */ if (_tx_thread_preempted_maps[MAP_INDEX] == ((ULONG) 0)) { - + /* No, clear the active bit to signify this preempt map has nothing set. */ TX_DIV32_BIT_SET(priority, priority_bit) _tx_thread_preempted_map_active = _tx_thread_preempted_map_active & (~(priority_bit)); @@ -1068,18 +1068,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -1092,13 +1092,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { - + /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); } @@ -1131,18 +1131,18 @@ ULONG time_stamp = ((ULONG) 0); /* Is the execute pointer different? */ if (_tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] != _tx_thread_execute_ptr) { - + /* Move to next entry. */ _tx_thread_performance__execute_log_index++; - + /* Check for wrap condition. */ if (_tx_thread_performance__execute_log_index >= TX_THREAD_EXECUTE_LOG_SIZE) { - + /* Set the index to the beginning. */ _tx_thread_performance__execute_log_index = ((UINT) 0); } - + /* Log the new execute pointer. */ _tx_thread_performance_execute_log[_tx_thread_performance__execute_log_index] = _tx_thread_execute_ptr; } @@ -1155,13 +1155,13 @@ ULONG time_stamp = ((ULONG) 0); suspend event. In that case, do nothing here. */ if (entry_ptr != TX_NULL) { - + /* Is the timestamp the same? */ if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp) { /* Timestamp is the same, set the "next thread pointer" to the new value of the - next thread to execute. This can be used by the trace analysis tool to keep + next thread to execute. This can be used by the trace analysis tool to keep track of next thread execution. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr); diff --git a/common/src/tx_thread_terminate.c b/common/src/tx_thread_terminate.c index a1037da2..f84a4994 100644 --- a/common/src/tx_thread_terminate.c +++ b/common/src/tx_thread_terminate.c @@ -201,7 +201,7 @@ ULONG suspension_sequence; /* Thread state change. */ TX_THREAD_STATE_CHANGE(thread_ptr, TX_TERMINATED) - /* Set the suspending flag. This prevents the thread from being + /* Set the suspending flag. This prevents the thread from being resumed before the cleanup routine is executed. */ thread_ptr -> tx_thread_suspending = TX_TRUE; @@ -279,7 +279,7 @@ ULONG suspension_sequence; if (_tx_thread_mutex_release != TX_NULL) { - /* Yes, call the mutex release function via a function pointer that + /* Yes, call the mutex release function via a function pointer that is setup during initialization. */ (_tx_thread_mutex_release)(thread_ptr); } diff --git a/common/src/tx_thread_time_slice.c b/common/src/tx_thread_time_slice.c index ebcd41b5..4dac5545 100644 --- a/common/src/tx_thread_time_slice.c +++ b/common/src/tx_thread_time_slice.c @@ -97,7 +97,7 @@ UINT preempt_disable; /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(thread_ptr) - + /* Set the next thread pointer to NULL. */ next_thread_ptr = TX_NULL; #endif @@ -130,15 +130,15 @@ UINT preempt_disable; /* Check to see if preemption-threshold is not being used. */ if (thread_ptr -> tx_thread_priority == thread_ptr -> tx_thread_preempt_threshold) { - + /* Preemption-threshold is not being used by this thread. */ - + /* There is another thread at this priority, make it the highest at this priority level. */ _tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr -> tx_thread_ready_next; - - /* Designate the highest priority thread as the one to execute. Don't use this - thread's priority as an index just in case a higher priority thread is now + + /* Designate the highest priority thread as the one to execute. Don't use this + thread's priority as an index just in case a higher priority thread is now ready! */ _tx_thread_execute_ptr = _tx_thread_priority_list[_tx_thread_highest_priority]; @@ -167,11 +167,11 @@ UINT preempt_disable; /* Pickup the volatile information. */ system_state = TX_THREAD_GET_SYSTEM_STATE(); preempt_disable = _tx_thread_preempt_disable; - + /* Insert this event into the trace buffer. */ TX_TRACE_IN_LINE_INSERT(TX_TRACE_TIME_SLICE, _tx_thread_execute_ptr, system_state, preempt_disable, TX_POINTER_TO_ULONG_CONVERT(&thread_ptr), TX_TRACE_INTERNAL_EVENTS) #endif - + /* Restore previous interrupt posture. */ TX_RESTORE diff --git a/common/src/tx_thread_time_slice_change.c b/common/src/tx_thread_time_slice_change.c index 8e834b2c..23e1eff9 100644 --- a/common/src/tx_thread_time_slice_change.c +++ b/common/src/tx_thread_time_slice_change.c @@ -105,7 +105,7 @@ TX_THREAD *current_thread; /* Determine if this thread is the currently executing thread. */ if (thread_ptr == current_thread) { - + /* Yes, update the time-slice countdown variable. */ _tx_timer_time_slice = new_time_slice; } diff --git a/common/src/tx_thread_timeout.c b/common/src/tx_thread_timeout.c index 01e69e7a..c0384d5d 100644 --- a/common/src/tx_thread_timeout.c +++ b/common/src/tx_thread_timeout.c @@ -128,7 +128,7 @@ ULONG suspension_sequence; /* Increment the number of timeouts for this thread. */ thread_ptr -> tx_thread_performance_timeout_count++; #endif - + /* Pickup the cleanup routine address. */ suspend_cleanup = thread_ptr -> tx_thread_suspend_cleanup; @@ -152,6 +152,7 @@ ULONG suspension_sequence; /* Call any cleanup routines. */ if (suspend_cleanup != TX_NULL) { + /* Yes, there is a function to call. */ (suspend_cleanup)(thread_ptr, suspension_sequence); } diff --git a/common/src/tx_thread_wait_abort.c b/common/src/tx_thread_wait_abort.c index 5893e667..e5fbffae 100644 --- a/common/src/tx_thread_wait_abort.c +++ b/common/src/tx_thread_wait_abort.c @@ -95,14 +95,14 @@ ULONG suspension_sequence; /* Determine if the thread is currently suspended. */ if (thread_ptr -> tx_thread_state < TX_SLEEP) { - - /* Thread is either ready, completed, terminated, or in a pure + + /* Thread is either ready, completed, terminated, or in a pure suspension condition. */ /* Restore interrupts. */ TX_RESTORE - /* Just return with an error message to indicate that + /* Just return with an error message to indicate that nothing was done. */ status = TX_WAIT_ABORT_ERROR; } @@ -136,7 +136,7 @@ ULONG suspension_sequence; { /* Process all other suspension timeouts. */ - + /* Set the state to suspended. */ thread_ptr -> tx_thread_state = TX_SUSPENDED; @@ -217,7 +217,7 @@ ULONG suspension_sequence; /* Disable interrupts. */ TX_DISABLE - + /* Decrement the disable preemption flag. */ _tx_thread_preempt_disable--; @@ -225,7 +225,7 @@ ULONG suspension_sequence; TX_RESTORE #endif - /* Return with an error message to indicate that + /* Return with an error message to indicate that nothing was done. */ status = TX_WAIT_ABORT_ERROR; } diff --git a/common/src/tx_time_get.c b/common/src/tx_time_get.c index db44bdb5..3c366559 100644 --- a/common/src/tx_time_get.c +++ b/common/src/tx_time_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _tx_time_get PORTABLE C */ -/* 6.1 */ +/* 6.1.3 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 Yuxin Zhou Modified comment(s), */ /* resulting in version 6.1 */ +/* 12-31-2020 Andres Mlinar Modified comment(s), */ +/* resulting in version 6.1.3 */ /* */ /**************************************************************************/ ULONG _tx_time_get(VOID) diff --git a/common/src/tx_timer_activate.c b/common/src/tx_timer_activate.c index 9529c462..8a9ef71c 100644 --- a/common/src/tx_timer_activate.c +++ b/common/src/tx_timer_activate.c @@ -83,7 +83,7 @@ UINT status; TX_DISABLE #ifdef TX_ENABLE_EVENT_TRACE - + /* If trace is enabled, insert this event into the trace buffer. */ TX_TRACE_IN_LINE_INSERT(TX_TRACE_TIMER_ACTIVATE, timer_ptr, 0, 0, 0, TX_TRACE_TIMER_EVENTS) #endif diff --git a/common/src/tx_timer_change.c b/common/src/tx_timer_change.c index b1748061..d051078e 100644 --- a/common/src/tx_timer_change.c +++ b/common/src/tx_timer_change.c @@ -77,7 +77,7 @@ UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedul TX_INTERRUPT_SAVE_AREA - + /* Disable interrupts to put the timer on the created list. */ TX_DISABLE @@ -90,7 +90,7 @@ TX_INTERRUPT_SAVE_AREA /* Determine if the timer is active. */ if (timer_ptr -> tx_timer_internal.tx_timer_internal_list_head == TX_NULL) { - + /* Setup the new expiration fields. */ timer_ptr -> tx_timer_internal.tx_timer_internal_remaining_ticks = initial_ticks; timer_ptr -> tx_timer_internal.tx_timer_internal_re_initialize_ticks = reschedule_ticks; diff --git a/common/src/tx_timer_create.c b/common/src/tx_timer_create.c index b4eb949d..9326d69a 100644 --- a/common/src/tx_timer_create.c +++ b/common/src/tx_timer_create.c @@ -75,7 +75,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, +UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG id), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate) { @@ -95,7 +95,7 @@ TX_TIMER *previous_timer; timer_ptr -> tx_timer_internal.tx_timer_internal_re_initialize_ticks = reschedule_ticks; timer_ptr -> tx_timer_internal.tx_timer_internal_timeout_function = expiration_function; timer_ptr -> tx_timer_internal.tx_timer_internal_timeout_param = expiration_input; - + /* Disable interrupts to put the timer on the created list. */ TX_DISABLE @@ -130,7 +130,7 @@ TX_TIMER *previous_timer; /* Increment the number of created timers. */ _tx_timer_created_count++; - + /* Optional timer create extended processing. */ TX_TIMER_CREATE_EXTENSION(timer_ptr) diff --git a/common/src/tx_timer_deactivate.c b/common/src/tx_timer_deactivate.c index 0ae1e448..25175cc6 100644 --- a/common/src/tx_timer_deactivate.c +++ b/common/src/tx_timer_deactivate.c @@ -80,7 +80,7 @@ TX_TIMER_INTERNAL *previous_timer; ULONG ticks_left; UINT active_timer_list; - + /* Setup internal timer pointer. */ internal_ptr = &(timer_ptr -> tx_timer_internal); @@ -125,7 +125,7 @@ UINT active_timer_list; active_timer_list = TX_TRUE; } } - + /* Determine if the timer is on active timer list. */ if (active_timer_list == TX_TRUE) { @@ -139,7 +139,7 @@ UINT active_timer_list; if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(list_head) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_current_ptr)) { - /* Calculate ticks left to expiration - just the difference between this + /* Calculate ticks left to expiration - just the difference between this timer's entry and the current timer pointer. */ ticks_left = (ULONG) (TX_TIMER_POINTER_DIF(list_head,_tx_timer_current_ptr)) + ((ULONG) 1); } @@ -148,57 +148,57 @@ UINT active_timer_list; /* Calculate the ticks left with a wrapped list condition. */ ticks_left = (ULONG) (TX_TIMER_POINTER_DIF(list_head,_tx_timer_list_start)); - + ticks_left = ticks_left + (ULONG) ((TX_TIMER_POINTER_DIF(_tx_timer_list_end, _tx_timer_current_ptr)) + ((ULONG) 1)); } /* Adjust the remaining ticks accordingly. */ if (internal_ptr -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { - + /* Subtract off the last full pass through the timer list and add the time left. */ - internal_ptr -> tx_timer_internal_remaining_ticks = + internal_ptr -> tx_timer_internal_remaining_ticks = (internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES) + ticks_left; } else { - + /* Just put the ticks left into the timer's remaining ticks. */ internal_ptr -> tx_timer_internal_remaining_ticks = ticks_left; } } else { - + /* Determine if this is timer has just expired. */ if (_tx_timer_expired_timer_ptr != internal_ptr) { - + /* No, it hasn't expired. Now check for remaining time greater than the list size. */ if (internal_ptr -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { - + /* Adjust the remaining ticks. */ - internal_ptr -> tx_timer_internal_remaining_ticks = + internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; } else { - + /* Set the remaining time to the reactivation time. */ internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_re_initialize_ticks; } } else { - + /* Set the remaining time to the reactivation time. */ internal_ptr -> tx_timer_internal_remaining_ticks = internal_ptr -> tx_timer_internal_re_initialize_ticks; } } - + /* Pickup the next timer. */ next_timer = internal_ptr -> tx_timer_internal_active_next; @@ -230,7 +230,7 @@ UINT active_timer_list; if (*(list_head) == internal_ptr) { - /* Update the next timer in the list with the list head + /* Update the next timer in the list with the list head pointer. */ next_timer -> tx_timer_internal_list_head = list_head; diff --git a/common/src/tx_timer_delete.c b/common/src/tx_timer_delete.c index 3a7a89b5..ba9d9417 100644 --- a/common/src/tx_timer_delete.c +++ b/common/src/tx_timer_delete.c @@ -106,7 +106,7 @@ TX_TIMER *previous_timer; /* Decrement the number of created timers. */ _tx_timer_created_count--; - + /* See if the timer is the only one on the list. */ if (_tx_timer_created_count == TX_EMPTY) { @@ -126,7 +126,7 @@ TX_TIMER *previous_timer; /* See if we have to update the created list head pointer. */ if (_tx_timer_created_ptr == timer_ptr) { - + /* Yes, move the head pointer to the next link. */ _tx_timer_created_ptr = next_timer; } diff --git a/common/src/tx_timer_expiration_process.c b/common/src/tx_timer_expiration_process.c index 38cce3df..c5b6e62a 100644 --- a/common/src/tx_timer_expiration_process.c +++ b/common/src/tx_timer_expiration_process.c @@ -105,7 +105,7 @@ TX_TIMER *timer_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR - /* Don't process in the ISR, wakeup the system timer thread to process the + /* Don't process in the ISR, wakeup the system timer thread to process the timer expiration. */ /* Disable interrupts. */ @@ -132,8 +132,8 @@ TX_TIMER *timer_ptr; #else - /* Process the timer expiration directly in the ISR. This increases the interrupt - processing, however, it eliminates the need for a system timer thread and associated + /* Process the timer expiration directly in the ISR. This increases the interrupt + processing, however, it eliminates the need for a system timer thread and associated resources. */ /* Disable interrupts. */ @@ -151,7 +151,7 @@ TX_TIMER *timer_ptr; { /* Proceed with timer processing. */ - + /* Set the timer interrupt processing active flag. */ _tx_timer_processing_active = TX_TRUE; @@ -159,7 +159,7 @@ TX_TIMER *timer_ptr; do { - /* First, move the current list pointer and clear the timer + /* First, move the current list pointer and clear the timer expired value. This allows the interrupt handling portion to continue looking for timer expirations. */ @@ -170,19 +170,19 @@ TX_TIMER *timer_ptr; is one! */ if (expired_timers != TX_NULL) { - + expired_timers -> tx_timer_internal_list_head = &expired_timers; } /* Set the current list pointer to NULL. */ *_tx_timer_current_ptr = TX_NULL; - /* Move the current pointer up one timer entry wrap if we get to + /* Move the current pointer up one timer entry wrap if we get to the end of the list. */ _tx_timer_current_ptr = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, 1); if (_tx_timer_current_ptr == _tx_timer_list_end) { - + _tx_timer_current_ptr = _tx_timer_list_start; } @@ -202,10 +202,10 @@ TX_TIMER *timer_ptr; /* Something is on the list. Remove it and process the expiration. */ current_timer = expired_timers; - + /* Pickup the next timer. */ next_timer = expired_timers -> tx_timer_internal_active_next; - + /* Set the reactivate timer to NULL. */ reactivate_timer = TX_NULL; @@ -214,7 +214,7 @@ TX_TIMER *timer_ptr; { /* Yes, this is the only timer in the list. */ - + /* Set the head pointer to NULL. */ expired_timers = TX_NULL; } @@ -222,7 +222,7 @@ TX_TIMER *timer_ptr; { /* No, not the only expired timer. */ - + /* Remove this timer from the expired list. */ previous_timer = current_timer -> tx_timer_internal_active_previous; next_timer -> tx_timer_internal_active_previous = previous_timer; @@ -237,7 +237,7 @@ TX_TIMER *timer_ptr; /* In any case, the timer is now off of the expired list. */ - /* Determine if the timer has expired or if it is just a really + /* Determine if the timer has expired or if it is just a really big timer that needs to be placed in the list again. */ if (current_timer -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { @@ -253,25 +253,25 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expiration adjustments on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance__expiration_adjust_count++; } } #endif /* Decrement the remaining ticks of the timer. */ - current_timer -> tx_timer_internal_remaining_ticks = + current_timer -> tx_timer_internal_remaining_ticks = current_timer -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; - + /* Set the timeout function to NULL in order to bypass the expiration. */ timeout_function = TX_NULL; @@ -289,7 +289,7 @@ TX_TIMER *timer_ptr; { /* Timer did expire. */ - + #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO /* Increment the total expirations counter. */ @@ -298,22 +298,22 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_expiration_count++; } } #endif - /* Copy the calling function and ID into local variables before interrupts + /* Copy the calling function and ID into local variables before interrupts are re-enabled. */ timeout_function = current_timer -> tx_timer_internal_timeout_function; timeout_param = current_timer -> tx_timer_internal_timeout_param; @@ -326,7 +326,7 @@ TX_TIMER *timer_ptr; { /* Make the timer appear that it is still active while processing - the expiration routine and with interrupts enabled. This will + the expiration routine and with interrupts enabled. This will permit proper processing of a timer deactivate from both the expiration routine and an ISR. */ current_timer -> tx_timer_internal_list_head = &reactivate_timer; @@ -353,7 +353,7 @@ TX_TIMER *timer_ptr; /* Call the timer-expiration function, if non-NULL. */ if (timeout_function != TX_NULL) { - + (timeout_function) (timeout_param); } @@ -381,16 +381,16 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_reactivate_count++; } } @@ -418,7 +418,7 @@ TX_TIMER *timer_ptr; /* At this point, we are ready to put the timer back on one of the timer lists. */ - + /* Calculate the proper place for the timer. */ timer_list = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, expiration_time); if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(timer_list) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_list_end)) @@ -432,13 +432,13 @@ TX_TIMER *timer_ptr; /* Now put the timer on this list. */ if ((*timer_list) == TX_NULL) { - + /* This list is NULL, just put the new timer on it. */ /* Setup the links in this timer. */ current_timer -> tx_timer_internal_active_next = current_timer; current_timer -> tx_timer_internal_active_previous = current_timer; - + /* Setup the list head pointer. */ *timer_list = current_timer; } @@ -474,7 +474,7 @@ TX_TIMER *timer_ptr; _tx_timer_processing_active = TX_FALSE; } } - + /* Restore interrupts. */ TX_RESTORE #endif diff --git a/common/src/tx_timer_info_get.c b/common/src/tx_timer_info_get.c index 62b47fca..aba17b6b 100644 --- a/common/src/tx_timer_info_get.c +++ b/common/src/tx_timer_info_get.c @@ -76,7 +76,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, +UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer) { @@ -101,10 +101,10 @@ UINT active_timer_list; /* Retrieve the name of the timer. */ if (name != TX_NULL) { - + *name = timer_ptr -> tx_timer_name; } - + /* Pickup address of internal timer structure. */ internal_ptr = &(timer_ptr -> tx_timer_internal); @@ -113,7 +113,7 @@ UINT active_timer_list; /* Default active to false. */ timer_active = TX_FALSE; - + /* Default the ticks left to the remaining ticks. */ ticks_left = internal_ptr -> tx_timer_internal_remaining_ticks; @@ -146,7 +146,7 @@ UINT active_timer_list; /* Calculate the amount of time that has elapsed since the timer was activated. */ - + /* Setup the list head pointer. */ list_head = internal_ptr -> tx_timer_internal_list_head; @@ -154,7 +154,7 @@ UINT active_timer_list; if (internal_ptr -> tx_timer_internal_list_head >= _tx_timer_current_ptr) { - /* Calculate ticks left to expiration - just the difference between this + /* Calculate ticks left to expiration - just the difference between this timer's entry and the current timer pointer. */ ticks_left = ((TX_TIMER_POINTER_DIF(list_head, _tx_timer_current_ptr)) + ((ULONG) 1)); } @@ -170,7 +170,7 @@ UINT active_timer_list; /* Adjust the remaining ticks accordingly. */ if (internal_ptr -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { - + /* Subtract off the last full pass through the timer list and add the time left. */ ticks_left = (internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES) + ticks_left; @@ -179,14 +179,14 @@ UINT active_timer_list; } else { - + /* The timer is not on the actual timer list so it must either be being processed or on a temporary list to be processed. */ /* Check to see if this timer is the timer currently being processed. */ if (_tx_timer_expired_timer_ptr == internal_ptr) { - + /* Timer dispatch routine is executing, waiting to execute, or just finishing. No more remaining ticks for this expiration. */ ticks_left = ((ULONG) 0); } @@ -195,17 +195,17 @@ UINT active_timer_list; /* Timer is not the one being processed, which means it must be on the temporary expiration list waiting to be processed. */ - + /* Calculate the remaining ticks for a timer in the process of expiring. */ if (ticks_left > TX_TIMER_ENTRIES) { - + /* Calculate the number of ticks remaining. */ ticks_left = internal_ptr -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; } else { - + /* Timer dispatch routine is waiting to execute, no more remaining ticks for this expiration. */ ticks_left = ((ULONG) 0); } @@ -216,13 +216,13 @@ UINT active_timer_list; /* Setup return values for an inactive timer. */ if (active != TX_NULL) { - + /* Setup the timer active indication. */ *active = timer_active; } if (remaining_ticks != TX_NULL) { - + /* Setup the default remaining ticks value. */ *remaining_ticks = ticks_left; } @@ -230,17 +230,17 @@ UINT active_timer_list; /* Pickup the reschedule ticks value. */ if (reschedule_ticks != TX_NULL) { - + *reschedule_ticks = internal_ptr -> tx_timer_internal_re_initialize_ticks; } - + /* Pickup the next created application timer. */ if (next_timer != TX_NULL) { - + *next_timer = timer_ptr -> tx_timer_created_next; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_timer_initialize.c b/common/src/tx_timer_initialize.c index 8532b1e6..564c005a 100644 --- a/common/src/tx_timer_initialize.c +++ b/common/src/tx_timer_initialize.c @@ -36,7 +36,7 @@ #ifndef TX_NO_TIMER -/* Define the system clock value that is continually incremented by the +/* Define the system clock value that is continually incremented by the periodic timer interrupt processing. */ volatile ULONG _tx_timer_system_clock; @@ -67,7 +67,7 @@ TX_TIMER_INTERNAL **_tx_timer_list_end; TX_TIMER_INTERNAL **_tx_timer_current_ptr; -/* Define the timer expiration flag. This is used to indicate that a timer +/* Define the timer expiration flag. This is used to indicate that a timer has expired. */ UINT _tx_timer_expired; @@ -146,8 +146,8 @@ ULONG _tx_timer_performance_expiration_count; /* Define the total number of timer expiration adjustments. These are required - if the expiration time is greater than the size of the timer list. In such - cases, the timer is placed at the end of the list and then reactivated + if the expiration time is greater than the size of the timer list. In such + cases, the timer is placed at the end of the list and then reactivated as many times as necessary to finally achieve the resulting timeout. */ ULONG _tx_timer_performance__expiration_adjust_count; @@ -241,26 +241,26 @@ UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR - /* Setup the variables associated with the system timer thread's stack and + /* Setup the variables associated with the system timer thread's stack and priority. */ _tx_timer_stack_start = (VOID *) &_tx_timer_thread_stack_area[0]; _tx_timer_stack_size = ((ULONG) TX_TIMER_THREAD_STACK_SIZE); _tx_timer_priority = ((UINT) TX_TIMER_THREAD_PRIORITY); - /* Create the system timer thread. This thread processes all of the timer + /* Create the system timer thread. This thread processes all of the timer expirations and reschedules. Its stack and priority are defined in the low-level initialization component. */ do { - + /* Create the system timer thread. */ - status = _tx_thread_create(&_tx_timer_thread, - TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT("System Timer Thread"), - _tx_timer_thread_entry, - ((ULONG) TX_TIMER_ID), - _tx_timer_stack_start, _tx_timer_stack_size, + status = _tx_thread_create(&_tx_timer_thread, + TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT("System Timer Thread"), + _tx_timer_thread_entry, + ((ULONG) TX_TIMER_ID), + _tx_timer_stack_start, _tx_timer_stack_size, _tx_timer_priority, _tx_timer_priority, TX_NO_TIME_SLICE, TX_DONT_START); - + #ifdef TX_SAFETY_CRITICAL /* Check return from thread create - if an error is detected throw an exception. */ @@ -274,9 +274,9 @@ UINT status; /* Define timer initialize extension. */ TX_TIMER_INITIALIZE_EXTENSION(status) - + } while (status != TX_SUCCESS); - + #else /* Clear the timer interrupt processing active flag. */ diff --git a/common/src/tx_timer_performance_info_get.c b/common/src/tx_timer_performance_info_get.c index 39e60b44..2c0a7e6e 100644 --- a/common/src/tx_timer_performance_info_get.c +++ b/common/src/tx_timer_performance_info_get.c @@ -96,15 +96,15 @@ UINT status; /* Determine if this is a legal request. */ if (timer_ptr == TX_NULL) { - + /* Timer pointer is illegal, return error. */ status = TX_PTR_ERROR; } - + /* Determine if the timer ID is invalid. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { - + /* Timer pointer is illegal, return error. */ status = TX_PTR_ERROR; } @@ -123,38 +123,38 @@ UINT status; /* Retrieve the number of activations of this timer. */ if (activates != TX_NULL) { - + *activates = timer_ptr -> tx_timer_performance_activate_count; } - + /* Retrieve the number of reactivations of this timer. */ if (reactivates != TX_NULL) { - + *reactivates = timer_ptr -> tx_timer_performance_reactivate_count; } - + /* Retrieve the number of deactivations of this timer. */ if (deactivates != TX_NULL) { - + *deactivates = timer_ptr -> tx_timer_performance_deactivate_count; } - + /* Retrieve the number of expirations of this timer. */ if (expirations != TX_NULL) { - + *expirations = timer_ptr -> tx_timer_performance_expiration_count; } - + /* Retrieve the number of expiration adjustments of this timer. */ if (expiration_adjusts != TX_NULL) { - + *expiration_adjusts = timer_ptr -> tx_timer_performance__expiration_adjust_count; } - + /* Restore interrupts. */ TX_RESTORE diff --git a/common/src/tx_timer_performance_system_info_get.c b/common/src/tx_timer_performance_system_info_get.c index 498cee30..443c10c3 100644 --- a/common/src/tx_timer_performance_system_info_get.c +++ b/common/src/tx_timer_performance_system_info_get.c @@ -101,35 +101,35 @@ TX_INTERRUPT_SAVE_AREA /* Retrieve the total number of timer activations. */ if (activates != TX_NULL) { - + *activates = _tx_timer_performance_activate_count; } /* Retrieve the total number of timer reactivations. */ if (reactivates != TX_NULL) { - + *reactivates = _tx_timer_performance_reactivate_count; } /* Retrieve the total number of timer deactivations. */ if (deactivates != TX_NULL) { - + *deactivates = _tx_timer_performance_deactivate_count; } /* Retrieve the total number of timer expirations. */ if (expirations != TX_NULL) { - + *expirations = _tx_timer_performance_expiration_count; } /* Retrieve the total number of timer expiration adjustments. */ if (expiration_adjusts != TX_NULL) { - + *expiration_adjusts = _tx_timer_performance__expiration_adjust_count; } @@ -138,7 +138,7 @@ TX_INTERRUPT_SAVE_AREA /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -147,37 +147,37 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (activates != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (reactivates != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (deactivates != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (expirations != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else if (expiration_adjusts != TX_NULL) { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_timer_system_activate.c b/common/src/tx_timer_system_activate.c index d0617a8d..08efdf24 100644 --- a/common/src/tx_timer_system_activate.c +++ b/common/src/tx_timer_system_activate.c @@ -93,11 +93,11 @@ ULONG expiration_time; /* Determine if there is a timer to activate. */ if (remaining_ticks != ((ULONG) 0)) { - + /* Determine if the timer is set to wait forever. */ if (remaining_ticks != TX_WAIT_FOREVER) { - + /* Valid timer activate request. */ /* Determine if the timer still needs activation. */ @@ -124,7 +124,7 @@ ULONG expiration_time; /* At this point, we are ready to put the timer on one of the timer lists. */ - + /* Calculate the proper place for the timer. */ timer_list = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, expiration_time); if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(timer_list) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_list_end)) @@ -134,11 +134,11 @@ ULONG expiration_time; delta = TX_TIMER_POINTER_DIF(timer_list, _tx_timer_list_end); timer_list = TX_TIMER_POINTER_ADD(_tx_timer_list_start, delta); } - + /* Now put the timer on this list. */ if ((*timer_list) == TX_NULL) { - + /* This list is NULL, just put the new timer on it. */ /* Setup the links in this timer. */ diff --git a/common/src/tx_timer_thread_entry.c b/common/src/tx_timer_thread_entry.c index 8b1a262d..f08f8397 100644 --- a/common/src/tx_timer_thread_entry.c +++ b/common/src/tx_timer_thread_entry.c @@ -101,14 +101,14 @@ TX_TIMER *timer_ptr; silly compiler warnings. */ if (timer_thread_input == TX_TIMER_ID) { - + /* Yes, valid thread entry, proceed... */ /* Now go into an infinite loop to process timer expirations. */ while (TX_LOOP_FOREVER) { - /* First, move the current list pointer and clear the timer + /* First, move the current list pointer and clear the timer expired value. This allows the interrupt handling portion to continue looking for timer expirations. */ TX_DISABLE @@ -120,19 +120,19 @@ TX_TIMER *timer_ptr; is one! */ if (expired_timers != TX_NULL) { - + expired_timers -> tx_timer_internal_list_head = &expired_timers; } /* Set the current list pointer to NULL. */ *_tx_timer_current_ptr = TX_NULL; - /* Move the current pointer up one timer entry wrap if we get to + /* Move the current pointer up one timer entry wrap if we get to the end of the list. */ _tx_timer_current_ptr = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, 1); if (_tx_timer_current_ptr == _tx_timer_list_end) { - + _tx_timer_current_ptr = _tx_timer_list_start; } @@ -155,7 +155,7 @@ TX_TIMER *timer_ptr; /* Pickup the next timer. */ next_timer = expired_timers -> tx_timer_internal_active_next; - + /* Set the reactivate_timer to NULL. */ reactivate_timer = TX_NULL; @@ -172,7 +172,7 @@ TX_TIMER *timer_ptr; { /* No, not the only expired timer. */ - + /* Remove this timer from the expired list. */ previous_timer = current_timer -> tx_timer_internal_active_previous; next_timer -> tx_timer_internal_active_previous = previous_timer; @@ -187,7 +187,7 @@ TX_TIMER *timer_ptr; /* In any case, the timer is now off of the expired list. */ - /* Determine if the timer has expired or if it is just a really + /* Determine if the timer has expired or if it is just a really big timer that needs to be placed in the list again. */ if (current_timer -> tx_timer_internal_remaining_ticks > TX_TIMER_ENTRIES) { @@ -203,25 +203,25 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expiration adjustments on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance__expiration_adjust_count++; } } #endif /* Decrement the remaining ticks of the timer. */ - current_timer -> tx_timer_internal_remaining_ticks = + current_timer -> tx_timer_internal_remaining_ticks = current_timer -> tx_timer_internal_remaining_ticks - TX_TIMER_ENTRIES; - + /* Set the timeout function to NULL in order to bypass the expiration. */ timeout_function = TX_NULL; @@ -248,22 +248,22 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_expiration_count++; } } #endif - - /* Copy the calling function and ID into local variables before interrupts + + /* Copy the calling function and ID into local variables before interrupts are re-enabled. */ timeout_function = current_timer -> tx_timer_internal_timeout_function; timeout_param = current_timer -> tx_timer_internal_timeout_param; @@ -276,12 +276,12 @@ TX_TIMER *timer_ptr; { /* Make the timer appear that it is still active while processing - the expiration routine and with interrupts enabled. This will + the expiration routine and with interrupts enabled. This will permit proper processing of a timer deactivate from both the expiration routine and an ISR. */ current_timer -> tx_timer_internal_list_head = &reactivate_timer; current_timer -> tx_timer_internal_active_next = current_timer; - + /* Setup the temporary timer list head pointer. */ reactivate_timer = current_timer; } @@ -303,7 +303,7 @@ TX_TIMER *timer_ptr; /* Call the timer-expiration function, if non-NULL. */ if (timeout_function != TX_NULL) { - + (timeout_function) (timeout_param); } @@ -331,16 +331,16 @@ TX_TIMER *timer_ptr; /* Determine if this is an application timer. */ if (current_timer -> tx_timer_internal_timeout_function != &_tx_thread_timeout) { - + /* Derive the application timer pointer. */ - + /* Pickup the application timer pointer. */ TX_USER_TIMER_POINTER_GET(current_timer, timer_ptr) /* Increment the number of expirations on this timer. */ if (timer_ptr -> tx_timer_id == TX_TIMER_ID) { - + timer_ptr -> tx_timer_performance_reactivate_count++; } } @@ -367,7 +367,7 @@ TX_TIMER *timer_ptr; /* At this point, we are ready to put the timer back on one of the timer lists. */ - + /* Calculate the proper place for the timer. */ timer_list = TX_TIMER_POINTER_ADD(_tx_timer_current_ptr, expiration_time); if (TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(timer_list) >= TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(_tx_timer_list_end)) @@ -381,7 +381,7 @@ TX_TIMER *timer_ptr; /* Now put the timer on this list. */ if ((*timer_list) == TX_NULL) { - + /* This list is NULL, just put the new timer on it. */ /* Setup the links in this timer. */ @@ -436,7 +436,7 @@ TX_TIMER *timer_ptr; /* Build pointer to the timer thread. */ thread_ptr = &_tx_timer_thread; - /* Set the status to suspending, in order to indicate the + /* Set the status to suspending, in order to indicate the suspension is in progress. */ thread_ptr -> tx_thread_state = TX_SUSPENDED; diff --git a/common/src/tx_trace_buffer_full_notify.c b/common/src/tx_trace_buffer_full_notify.c index d0901e0e..383b134a 100644 --- a/common/src/tx_trace_buffer_full_notify.c +++ b/common/src/tx_trace_buffer_full_notify.c @@ -84,7 +84,7 @@ UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer)) /* Return success. */ return(TX_SUCCESS); - + #else UINT status; @@ -93,13 +93,13 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (full_buffer_callback != TX_NULL) { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_trace_disable.c b/common/src/tx_trace_disable.c index ef1df303..dbf8f3b2 100644 --- a/common/src/tx_trace_disable.c +++ b/common/src/tx_trace_disable.c @@ -73,12 +73,12 @@ UINT _tx_trace_disable(VOID) #ifdef TX_ENABLE_EVENT_TRACE UINT status; - - + + /* Determine if trace is already disabled. */ if (_tx_trace_buffer_current_ptr == TX_NULL) { - + /* Yes, trace is already disabled. */ status = TX_NOT_DONE; } @@ -88,11 +88,11 @@ UINT status; /* Otherwise, simply clear the current pointer and registery start pointer to disable the trace. */ _tx_trace_buffer_current_ptr = TX_NULL; _tx_trace_registry_start_ptr = TX_NULL; - + /* Successful completion. */ status = TX_SUCCESS; } - + /* Return completion status. */ return(status); diff --git a/common/src/tx_trace_enable.c b/common/src/tx_trace_enable.c index 8278d5e5..b325bac0 100644 --- a/common/src/tx_trace_enable.c +++ b/common/src/tx_trace_enable.c @@ -106,7 +106,7 @@ ULONG i; UINT status; - /* First, see if there is enough room for the control header, the registry entries, and at least one event in + /* First, see if there is enough room for the control header, the registry entries, and at least one event in memory supplied to this call. */ if (trace_buffer_size < ((sizeof(TX_TRACE_HEADER)) + ((sizeof(TX_TRACE_OBJECT_ENTRY)) * registry_entries) + (sizeof(TX_TRACE_BUFFER_ENTRY)))) { @@ -118,7 +118,7 @@ UINT status; /* Determine if trace is already enabled. */ else if (_tx_trace_buffer_current_ptr != TX_NULL) { - + /* Yes, trace is already enabled. */ status = TX_NOT_DONE; } @@ -154,7 +154,7 @@ UINT status; /* Convert to a registry entry pointer. */ entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr); - + /* Initialize object registry entry. */ entry_ptr -> tx_trace_object_entry_available = (UCHAR) TX_TRUE; entry_ptr -> tx_trace_object_entry_type = (UCHAR) TX_TRACE_OBJECT_TYPE_NOT_VALID; @@ -165,10 +165,10 @@ UINT status; /* Setup the total number of registry entries. */ _tx_trace_total_registry_entries = registry_entries; - + /* Setup the object registry available count to the total number of registry entries. */ _tx_trace_available_registry_entries = registry_entries; - + /* Setup the search starting index to the first entry. */ _tx_trace_registry_search_start = ((ULONG) 0); @@ -180,7 +180,7 @@ UINT status; /* Setup pointer to the start of the actual event trace log. */ _tx_trace_buffer_start_ptr = TX_UCHAR_TO_ENTRY_POINTER_CONVERT(work_ptr); - + /* Save the event trace log start address. */ event_start_ptr = work_ptr; @@ -197,7 +197,7 @@ UINT status; /* Convert to a trace event pointer. */ event_ptr = TX_UCHAR_TO_ENTRY_POINTER_CONVERT(work_ptr); - + /* Mark this trace event as invalid. */ event_ptr -> tx_trace_buffer_entry_thread_pointer = ((ULONG) 0); } @@ -238,9 +238,9 @@ UINT status; /* Decrement the counter. */ i--; - + /* Register this thread. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_THREAD, thread_ptr, thread_ptr -> tx_thread_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_THREAD, thread_ptr, thread_ptr -> tx_thread_name, TX_POINTER_TO_ULONG_CONVERT(thread_ptr -> tx_thread_stack_start), (ULONG) thread_ptr -> tx_thread_stack_size); /* Move to the next thread. */ @@ -259,7 +259,7 @@ UINT status; i--; /* Register this timer. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_TIMER, timer_ptr, timer_ptr -> tx_timer_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_TIMER, timer_ptr, timer_ptr -> tx_timer_name, ((ULONG) 0), timer_ptr -> tx_timer_internal.tx_timer_internal_re_initialize_ticks); /* Move to the next timer. */ @@ -297,7 +297,7 @@ UINT status; i--; /* Register this queue. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_QUEUE, queue_ptr, queue_ptr -> tx_queue_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_QUEUE, queue_ptr, queue_ptr -> tx_queue_name, (queue_ptr -> tx_queue_capacity * (sizeof(ULONG))), ((ULONG) 0)); /* Move to the next queue. */ @@ -334,7 +334,7 @@ UINT status; i--; /* Register this mutex. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_MUTEX, mutex_ptr, mutex_ptr -> tx_mutex_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_MUTEX, mutex_ptr, mutex_ptr -> tx_mutex_name, (ULONG) mutex_ptr -> tx_mutex_inherit, ((ULONG) 0)); /* Move to the next mutex. */ @@ -353,7 +353,7 @@ UINT status; i--; /* Register this block pool. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_BLOCK_POOL, block_pool_ptr, block_pool_ptr -> tx_block_pool_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_BLOCK_POOL, block_pool_ptr, block_pool_ptr -> tx_block_pool_name, block_pool_ptr -> tx_block_pool_size, ((ULONG) 0)); /* Move to the next block pool. */ @@ -372,7 +372,7 @@ UINT status; i--; /* Register this byte pool. */ - _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_BYTE_POOL, byte_pool_ptr, byte_pool_ptr -> tx_byte_pool_name, + _tx_trace_object_register(TX_TRACE_OBJECT_TYPE_BYTE_POOL, byte_pool_ptr, byte_pool_ptr -> tx_byte_pool_name, byte_pool_ptr -> tx_byte_pool_size, ((ULONG) 0)); /* Move to the next byte pool. */ @@ -401,7 +401,7 @@ UINT status; /* Return successful completion. */ status = TX_SUCCESS; } - + /* Return completion status. */ return(status); #else @@ -412,25 +412,25 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (trace_buffer_start != TX_NULL) { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } else if (trace_buffer_size == ((ULONG) 0)) { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } else if (registry_entries == ((ULONG) 0)) { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common/src/tx_trace_event_filter.c b/common/src/tx_trace_event_filter.c index 4bcedafa..ed97f8a3 100644 --- a/common/src/tx_trace_event_filter.c +++ b/common/src/tx_trace_event_filter.c @@ -90,17 +90,17 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (event_filter_bits != ((ULONG) 0)) { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } else { - + /* Trace not enabled, return an error. */ status = TX_FEATURE_NOT_ENABLED; } - + /* Return completion status. */ return(status); #endif diff --git a/common/src/tx_trace_event_unfilter.c b/common/src/tx_trace_event_unfilter.c index 5dc5c085..f65690ec 100644 --- a/common/src/tx_trace_event_unfilter.c +++ b/common/src/tx_trace_event_unfilter.c @@ -81,7 +81,7 @@ UINT _tx_trace_event_unfilter(ULONG event_unfilter_bits) /* Return success. */ return(TX_SUCCESS); - + #else UINT status; diff --git a/common/src/tx_trace_initialize.c b/common/src/tx_trace_initialize.c index 18d24feb..d904740a 100644 --- a/common/src/tx_trace_initialize.c +++ b/common/src/tx_trace_initialize.c @@ -60,7 +60,7 @@ TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_end_ptr; TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_current_ptr; -/* Define the trace event enable bits, where each bit represents a type of event that can be enabled +/* Define the trace event enable bits, where each bit represents a type of event that can be enabled or disabled dynamically by the application. */ ULONG _tx_trace_event_enable_bits; @@ -72,9 +72,9 @@ ULONG _tx_trace_event_enable_bits; ULONG _tx_trace_simulated_time; -/* Define the function pointer used to call the application when the trace buffer wraps. If NULL, +/* Define the function pointer used to call the application when the trace buffer wraps. If NULL, the application has not registered a callback function. */ - + VOID (*_tx_trace_full_notify_function)(VOID *buffer); diff --git a/common/src/tx_trace_isr_enter_insert.c b/common/src/tx_trace_isr_enter_insert.c index 32a5efa9..fa29b750 100644 --- a/common/src/tx_trace_isr_enter_insert.c +++ b/common/src/tx_trace_isr_enter_insert.c @@ -100,7 +100,7 @@ UINT preempt_disable; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (isr_id != ((ULONG) 0)) { - + /* NOP code. */ TX_DISABLE TX_RESTORE diff --git a/common/src/tx_trace_isr_exit_insert.c b/common/src/tx_trace_isr_exit_insert.c index 5b6866a6..ff0ec6c8 100644 --- a/common/src/tx_trace_isr_exit_insert.c +++ b/common/src/tx_trace_isr_exit_insert.c @@ -100,7 +100,7 @@ UINT preempt_disable; /* Access input arguments just for the sake of lint, MISRA, etc. */ if (isr_id != ((ULONG) 0)) { - + /* NOP code. */ TX_DISABLE TX_RESTORE diff --git a/common/src/tx_trace_object_register.c b/common/src/tx_trace_object_register.c index e0d24981..da2dafcf 100644 --- a/common/src/tx_trace_object_register.c +++ b/common/src/tx_trace_object_register.c @@ -98,7 +98,7 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; /* Determine if there are available entries in the registry. */ if (_tx_trace_available_registry_entries != ((ULONG) 0)) { - + /* There are more available entries, proceed. */ /* Initialize found to the max entries... indicating no space was found. */ @@ -125,7 +125,7 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; loop_break = TX_TRUE; } - /* Determine if this entry matches the object pointer... we must reuse old entries left in the + /* Determine if this entry matches the object pointer... we must reuse old entries left in the registry. */ if (entry_ptr -> tx_trace_object_entry_thread_pointer == TX_POINTER_TO_ULONG_CONVERT(object_ptr)) { @@ -134,11 +134,11 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; found = i; loop_break = TX_TRUE; } - + /* Determine if we should break out of the loop. */ if (loop_break == TX_TRUE) { - + /* Yes, break out of the loop. */ break; } @@ -154,30 +154,30 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; } else { - + /* Setup a pointer to the found entry. */ work_ptr = TX_OBJECT_TO_UCHAR_POINTER_CONVERT(_tx_trace_registry_start_ptr); work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, ((sizeof(TX_TRACE_OBJECT_ENTRY))*found)); entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr); - + if (entry_ptr -> tx_trace_object_entry_type != ((UCHAR) 0)) { found = i; } } } - + /* Move to the next entry. */ i++; - + /* Determine if we have wrapped the list. */ if (i >= entries) { - + /* Yes, wrap to the beginning of the list. */ i = ((ULONG) 0); } - + } while (i != _tx_trace_registry_search_start); /* Now determine if an empty or reuse entry has been found. */ @@ -190,24 +190,24 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; /* Adjust the search index to the next entry. */ if ((found + ((ULONG) 1)) < entries) { - + /* Start searching from the next index. */ _tx_trace_registry_search_start = found + ((ULONG) 1); } else { - + /* Reset the search to the beginning of the list. */ _tx_trace_registry_search_start = ((ULONG) 0); } - + /* Yes, an entry has been found... */ - + /* Build a pointer to the found entry. */ work_ptr = TX_OBJECT_TO_UCHAR_POINTER_CONVERT(_tx_trace_registry_start_ptr); work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, ((sizeof(TX_TRACE_OBJECT_ENTRY))*found)); entry_ptr = TX_UCHAR_TO_OBJECT_POINTER_CONVERT(work_ptr); - + /* Populate the found entry! */ entry_ptr -> tx_trace_object_entry_available = ((UCHAR) TX_FALSE); entry_ptr -> tx_trace_object_entry_type = object_type; @@ -222,7 +222,7 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; /* Setup work pointer to the object name character. */ work_ptr = TX_CHAR_TO_UCHAR_POINTER_CONVERT(object_name); work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, i); - + /* Copy a character of the name. */ entry_ptr -> tx_trace_object_entry_name[i] = (UCHAR) *work_ptr; @@ -241,17 +241,17 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; { /* Yes, a thread object is present. */ - + /* Setup a pointer to the thread. */ thread_ptr = TX_VOID_TO_THREAD_POINTER_CONVERT(object_ptr); - + /* Store the thread's priority in the reserved bits. */ entry_ptr -> tx_trace_object_entry_reserved1 = ((UCHAR) 0x80) | ((UCHAR) (thread_ptr -> tx_thread_priority >> ((UCHAR) 8))); entry_ptr -> tx_trace_object_entry_reserved2 = (UCHAR) (thread_ptr -> tx_thread_priority & ((UCHAR) 0xFF)); } else { - + /* For all other objects, set the reserved bytes to 0. */ entry_ptr -> tx_trace_object_entry_reserved1 = ((UCHAR) 0); entry_ptr -> tx_trace_object_entry_reserved2 = ((UCHAR) 0); @@ -267,19 +267,19 @@ TX_INTERRUPT_SAVE_AREA /* Access input arguments just for the sake of lint, MISRA, etc. */ if (object_type != ((UCHAR) 0)) { - + if (object_ptr != TX_NULL) { - + if (object_name != TX_NULL) { - + if (parameter_1 != ((ULONG) 0)) { - + if (parameter_2 != ((ULONG) 0)) { - + /* NOP code. */ TX_DISABLE TX_RESTORE diff --git a/common/src/tx_trace_object_unregister.c b/common/src/tx_trace_object_unregister.c index ea90e75b..5c1bc7d2 100644 --- a/common/src/tx_trace_object_unregister.c +++ b/common/src/tx_trace_object_unregister.c @@ -101,7 +101,7 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr; if (entry_ptr -> tx_trace_object_entry_thread_pointer == TX_POINTER_TO_ULONG_CONVERT(object_ptr)) { - /* Mark this entry as available, but leave the other information so that old trace entries can + /* Mark this entry as available, but leave the other information so that old trace entries can still find it - if necessary! */ entry_ptr -> tx_trace_object_entry_available = ((UCHAR) TX_TRUE); @@ -123,7 +123,7 @@ TX_INTERRUPT_SAVE_AREA /* Access input arguments just for the sake of lint, MISRA, etc. */ if (object_ptr != TX_NULL) { - + /* NOP code. */ TX_DISABLE TX_RESTORE diff --git a/common/src/tx_trace_user_event_insert.c b/common/src/tx_trace_user_event_insert.c index 51ad9c3f..6d0b4004 100644 --- a/common/src/tx_trace_user_event_insert.c +++ b/common/src/tx_trace_user_event_insert.c @@ -88,7 +88,7 @@ UINT status; /* Determine if trace is disabled. */ if (_tx_trace_buffer_current_ptr == TX_NULL) { - + /* Yes, trace is already disabled. */ status = TX_NOT_DONE; } @@ -101,7 +101,7 @@ UINT status; #else TX_TRACE_IN_LINE_INSERT(event_id, info_field_1, info_field_2, info_field_3, info_field_4, TX_TRACE_USER_EVENTS) #endif - + /* Return successful status. */ status = TX_SUCCESS; } @@ -111,7 +111,7 @@ UINT status; /* Return completion status. */ return(status); - + #else UINT status; diff --git a/common/src/txe_block_allocate.c b/common/src/txe_block_allocate.c index 0ce09d99..cf4c2ed4 100644 --- a/common/src/txe_block_allocate.c +++ b/common/src/txe_block_allocate.c @@ -115,8 +115,8 @@ TX_THREAD *current_thread; } else { - - /* Check for a wait option error. Only threads are allowed any form of + + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -128,7 +128,7 @@ TX_THREAD *current_thread; /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } - + #ifndef TX_TIMER_PROCESS_IN_ISR else { diff --git a/common/src/txe_block_pool_create.c b/common/src/txe_block_pool_create.c index 07146e36..d964f1cb 100644 --- a/common/src/txe_block_pool_create.c +++ b/common/src/txe_block_pool_create.c @@ -149,7 +149,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -175,7 +175,7 @@ TX_THREAD *thread_ptr; { /* Check for invalid pool size. */ - if ((((block_size/(sizeof(void *)))*(sizeof(void *))) + (sizeof(void *))) > + if ((((block_size/(sizeof(void *)))*(sizeof(void *))) + (sizeof(void *))) > ((pool_size/(sizeof(void *)))*(sizeof(void *)))) { @@ -202,11 +202,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_block_pool_delete.c b/common/src/txe_block_pool_delete.c index 42342568..2ee152b9 100644 --- a/common/src/txe_block_pool_delete.c +++ b/common/src/txe_block_pool_delete.c @@ -87,7 +87,7 @@ TX_THREAD *thread_ptr; /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid pool pointer. */ if (pool_ptr == TX_NULL) { @@ -99,7 +99,7 @@ TX_THREAD *thread_ptr; /* Now check the pool ID. */ else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID) { - + /* Pool pointer is invalid, return appropriate error code. */ status = TX_POOL_ERROR; } @@ -109,7 +109,7 @@ TX_THREAD *thread_ptr; /* Is the call from an ISR or initialization? */ else if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { - + /* Invalid caller of this function, return appropriate error code. */ status = TX_CALLER_ERROR; } @@ -136,7 +136,7 @@ TX_THREAD *thread_ptr; /* Call actual block pool delete function. */ status = _tx_block_pool_delete(pool_ptr); - + #ifndef TX_TIMER_PROCESS_IN_ISR } #endif diff --git a/common/src/txe_block_pool_info_get.c b/common/src/txe_block_pool_info_get.c index d03a8c6d..ecd544c4 100644 --- a/common/src/txe_block_pool_info_get.c +++ b/common/src/txe_block_pool_info_get.c @@ -78,8 +78,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, - ULONG *total_blocks, TX_THREAD **first_suspended, +UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, + ULONG *total_blocks, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BLOCK_POOL **next_pool) { @@ -106,7 +106,7 @@ UINT status; { /* Otherwise, call the actual block pool information get service. */ - status = _tx_block_pool_info_get(pool_ptr, name, available_blocks, + status = _tx_block_pool_info_get(pool_ptr, name, available_blocks, total_blocks, first_suspended, suspended_count, next_pool); } diff --git a/common/src/txe_block_release.c b/common/src/txe_block_release.c index 908e3f6f..7c4ca6aa 100644 --- a/common/src/txe_block_release.c +++ b/common/src/txe_block_release.c @@ -88,7 +88,7 @@ UCHAR *work_ptr; else { - /* Pickup the pool pointer which is just previous to the starting + /* Pickup the pool pointer which is just previous to the starting address of block that the caller sees. */ work_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(block_ptr); work_ptr = TX_UCHAR_POINTER_SUB(work_ptr, (sizeof(UCHAR *))); @@ -103,7 +103,7 @@ UCHAR *work_ptr; /* Pool pointer is invalid, return appropriate error code. */ status = TX_PTR_ERROR; } - + /* Now check for invalid pool ID. */ else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID) { diff --git a/common/src/txe_byte_allocate.c b/common/src/txe_byte_allocate.c index 5f48dbc6..7c522bae 100644 --- a/common/src/txe_byte_allocate.c +++ b/common/src/txe_byte_allocate.c @@ -80,7 +80,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, +UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, ULONG wait_option) { @@ -96,15 +96,15 @@ TX_THREAD *thread_ptr; /* Check for an invalid byte pool pointer. */ if (pool_ptr == TX_NULL) { - + /* Byte pool pointer is invalid, return appropriate error code. */ status = TX_POOL_ERROR; } - + /* Now check for invalid pool ID. */ else if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID) { - + /* Byte pool pointer is invalid, return appropriate error code. */ status = TX_POOL_ERROR; } @@ -124,7 +124,7 @@ TX_THREAD *thread_ptr; /* Error in size, return appropriate error. */ status = TX_SIZE_ERROR; } - + /* Determine if the size is greater than the pool size. */ else if (memory_size > pool_ptr -> tx_byte_pool_size) { @@ -136,7 +136,7 @@ TX_THREAD *thread_ptr; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -144,14 +144,14 @@ TX_THREAD *thread_ptr; /* Is call from ISR or Initialization? */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { - + /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } } } #ifndef TX_TIMER_PROCESS_IN_ISR - + /* Check for timer execution. */ if (status == TX_SUCCESS) { @@ -172,15 +172,15 @@ TX_THREAD *thread_ptr; /* Is everything still okay? */ if (status == TX_SUCCESS) { - + /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_byte_pool_create.c b/common/src/txe_byte_pool_create.c index 324160b8..291a7c74 100644 --- a/common/src/txe_byte_pool_create.c +++ b/common/src/txe_byte_pool_create.c @@ -114,7 +114,7 @@ TX_THREAD *thread_ptr; } else { - + /* Disable interrupts. */ TX_DISABLE @@ -148,7 +148,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -166,7 +166,7 @@ TX_THREAD *thread_ptr; /* Check for an invalid starting address. */ else if (pool_start == TX_NULL) { - + /* Null starting address pointer, return appropriate error. */ status = TX_PTR_ERROR; } @@ -198,11 +198,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_byte_pool_delete.c b/common/src/txe_byte_pool_delete.c index 29e3d30b..28f33dff 100644 --- a/common/src/txe_byte_pool_delete.c +++ b/common/src/txe_byte_pool_delete.c @@ -87,7 +87,7 @@ TX_THREAD *thread_ptr; /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid byte pool pointer. */ if (pool_ptr == TX_NULL) { @@ -107,7 +107,7 @@ TX_THREAD *thread_ptr; /* Check for interrupt or initialization. */ else if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { - + /* Invalid caller of this function, return appropriate error code. */ status = TX_CALLER_ERROR; } @@ -134,7 +134,7 @@ TX_THREAD *thread_ptr; /* Call actual byte pool delete function. */ status = _tx_byte_pool_delete(pool_ptr); - + #ifndef TX_TIMER_PROCESS_IN_ISR } #endif diff --git a/common/src/txe_byte_pool_info_get.c b/common/src/txe_byte_pool_info_get.c index b2b97096..69ec38c6 100644 --- a/common/src/txe_byte_pool_info_get.c +++ b/common/src/txe_byte_pool_info_get.c @@ -78,8 +78,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, - ULONG *fragments, TX_THREAD **first_suspended, +UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, + ULONG *fragments, TX_THREAD **first_suspended, ULONG *suspended_count, TX_BYTE_POOL **next_pool) { @@ -105,7 +105,7 @@ UINT status; { /* Otherwise, call the actual byte pool information get service. */ - status = _tx_byte_pool_info_get(pool_ptr, name, available_bytes, + status = _tx_byte_pool_info_get(pool_ptr, name, available_bytes, fragments, first_suspended, suspended_count, next_pool); } diff --git a/common/src/txe_byte_pool_prioritize.c b/common/src/txe_byte_pool_prioritize.c index aa64f7c3..3a09dd37 100644 --- a/common/src/txe_byte_pool_prioritize.c +++ b/common/src/txe_byte_pool_prioritize.c @@ -82,7 +82,7 @@ UINT status; /* Byte pool pointer is invalid, return appropriate error code. */ status = TX_POOL_ERROR; } - + /* Now check for invalid pool ID. */ else if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID) { diff --git a/common/src/txe_byte_release.c b/common/src/txe_byte_release.c index 4a181145..99000210 100644 --- a/common/src/txe_byte_release.c +++ b/common/src/txe_byte_release.c @@ -112,11 +112,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_event_flags_create.c b/common/src/txe_event_flags_create.c index 8ee2f44a..67da058a 100644 --- a/common/src/txe_event_flags_create.c +++ b/common/src/txe_event_flags_create.c @@ -129,12 +129,12 @@ TX_THREAD *thread_ptr; /* Determine if this group matches the event flags group in the list. */ if (group_ptr == next_group) { - + break; } else { - + /* Move to the next group. */ next_group = next_group -> tx_event_flags_group_created_next; } @@ -145,7 +145,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -179,11 +179,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_event_flags_delete.c b/common/src/txe_event_flags_delete.c index 0a4fc127..5a4031c8 100644 --- a/common/src/txe_event_flags_delete.c +++ b/common/src/txe_event_flags_delete.c @@ -87,7 +87,7 @@ TX_THREAD *thread_ptr; /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid event flag group pointer. */ if (group_ptr == TX_NULL) { @@ -95,7 +95,7 @@ TX_THREAD *thread_ptr; /* Event flags group pointer is invalid, return appropriate error code. */ status = TX_GROUP_ERROR; } - + /* Now check for invalid event flag group ID. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { diff --git a/common/src/txe_event_flags_get.c b/common/src/txe_event_flags_get.c index c67becce..a77b6269 100644 --- a/common/src/txe_event_flags_get.c +++ b/common/src/txe_event_flags_get.c @@ -102,7 +102,7 @@ TX_THREAD *current_thread; /* Event flags group pointer is invalid, return appropriate error code. */ status = TX_GROUP_ERROR; } - + /* Now check for invalid event group ID. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { @@ -121,7 +121,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -136,7 +136,7 @@ TX_THREAD *current_thread; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(current_thread) @@ -155,7 +155,7 @@ TX_THREAD *current_thread; /* Is everything still okay? */ if (status == TX_SUCCESS) { - + /* Check for invalid get option. */ if (get_option > TX_AND_CLEAR) { diff --git a/common/src/txe_event_flags_info_get.c b/common/src/txe_event_flags_info_get.c index ac96f7ee..b5268e2e 100644 --- a/common/src/txe_event_flags_info_get.c +++ b/common/src/txe_event_flags_info_get.c @@ -80,8 +80,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_EVENT_FLAGS_GROUP **next_group) { @@ -95,7 +95,7 @@ UINT status; /* Event flags group pointer is invalid, return appropriate error code. */ status = TX_GROUP_ERROR; } - + /* Now check for invalid event flag group ID. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { @@ -107,7 +107,7 @@ UINT status; { /* Otherwise, call the actual event flags group information get service. */ - status = _tx_event_flags_info_get(group_ptr, name, current_flags, first_suspended, + status = _tx_event_flags_info_get(group_ptr, name, current_flags, first_suspended, suspended_count, next_group); } diff --git a/common/src/txe_event_flags_set.c b/common/src/txe_event_flags_set.c index bafdf020..81c39955 100644 --- a/common/src/txe_event_flags_set.c +++ b/common/src/txe_event_flags_set.c @@ -90,7 +90,7 @@ UINT status; /* Event flags group pointer is invalid, return appropriate error code. */ status = TX_GROUP_ERROR; } - + /* Now check for invalid event flag group ID. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { @@ -107,7 +107,7 @@ UINT status; if (set_option != TX_OR) { - + /* Invalid set events option, return appropriate error. */ status = TX_OPTION_ERROR; } diff --git a/common/src/txe_event_flags_set_notify.c b/common/src/txe_event_flags_set_notify.c index 23d59010..b0f4357a 100644 --- a/common/src/txe_event_flags_set_notify.c +++ b/common/src/txe_event_flags_set_notify.c @@ -85,7 +85,7 @@ UINT status; /* Event flags group pointer is invalid, return appropriate error code. */ status = TX_GROUP_ERROR; } - + /* Now check for invalid event group ID. */ else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID) { diff --git a/common/src/txe_mutex_create.c b/common/src/txe_mutex_create.c index 64ae1e28..57c104e7 100644 --- a/common/src/txe_mutex_create.c +++ b/common/src/txe_mutex_create.c @@ -102,7 +102,7 @@ TX_THREAD *thread_ptr; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check to make sure the control block is the correct size. */ else if (mutex_control_block_size != (sizeof(TX_MUTEX))) { @@ -146,7 +146,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -162,14 +162,14 @@ TX_THREAD *thread_ptr; } else { - + /* Check for a valid inherit option. */ if (inherit != TX_INHERIT) { if (inherit != TX_NO_INHERIT) { - + /* Inherit option is illegal. */ status = TX_INHERIT_ERROR; } @@ -198,11 +198,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_mutex_delete.c b/common/src/txe_mutex_delete.c index 8f174f0a..0b7ab706 100644 --- a/common/src/txe_mutex_delete.c +++ b/common/src/txe_mutex_delete.c @@ -87,7 +87,7 @@ TX_THREAD *thread_ptr; /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid mutex pointer. */ if (mutex_ptr == TX_NULL) { @@ -95,7 +95,7 @@ TX_THREAD *thread_ptr; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check for a valid mutex ID. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { diff --git a/common/src/txe_mutex_get.c b/common/src/txe_mutex_get.c index 3ca1a1b3..dd660009 100644 --- a/common/src/txe_mutex_get.c +++ b/common/src/txe_mutex_get.c @@ -95,7 +95,7 @@ TX_THREAD *current_thread; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check for a valid mutex ID. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { @@ -106,7 +106,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -145,11 +145,11 @@ TX_THREAD *current_thread; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { - + /* Now, make sure the call is from an interrupt and not initialization. */ if (TX_THREAD_GET_SYSTEM_STATE() < TX_INITIALIZE_IN_PROGRESS) { - + /* Yes, invalid caller of this function, return appropriate error code. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_mutex_info_get.c b/common/src/txe_mutex_info_get.c index 439295b3..69e3c814 100644 --- a/common/src/txe_mutex_info_get.c +++ b/common/src/txe_mutex_info_get.c @@ -80,7 +80,7 @@ /* */ /**************************************************************************/ UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex) { @@ -94,7 +94,7 @@ UINT status; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check for invalid mutex ID. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { @@ -106,7 +106,7 @@ UINT status; { /* Otherwise, call the actual mutex information get service. */ - status = _tx_mutex_info_get(mutex_ptr, name, count, owner, first_suspended, + status = _tx_mutex_info_get(mutex_ptr, name, count, owner, first_suspended, suspended_count, next_mutex); } diff --git a/common/src/txe_mutex_prioritize.c b/common/src/txe_mutex_prioritize.c index cf230eb8..679e3ac8 100644 --- a/common/src/txe_mutex_prioritize.c +++ b/common/src/txe_mutex_prioritize.c @@ -82,7 +82,7 @@ UINT status; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check for invalid mutex ID. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { diff --git a/common/src/txe_mutex_put.c b/common/src/txe_mutex_put.c index e7b711a3..7a6fdffc 100644 --- a/common/src/txe_mutex_put.c +++ b/common/src/txe_mutex_put.c @@ -87,7 +87,7 @@ UINT status; /* Mutex pointer is invalid, return appropriate error code. */ status = TX_MUTEX_ERROR; } - + /* Now check for invalid mutex ID. */ else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID) { @@ -101,11 +101,11 @@ UINT status; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_queue_create.c b/common/src/txe_queue_create.c index 8a7d0beb..592d0a89 100644 --- a/common/src/txe_queue_create.c +++ b/common/src/txe_queue_create.c @@ -80,7 +80,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, +UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size, UINT queue_control_block_size) { @@ -104,7 +104,7 @@ TX_THREAD *thread_ptr; /* Queue pointer is invalid, return appropriate error code. */ status = TX_QUEUE_ERROR; } - + /* Now check for a valid control block size. */ else if (queue_control_block_size != (sizeof(TX_QUEUE))) { @@ -137,7 +137,7 @@ TX_THREAD *thread_ptr; } else { - + /* Move to the next queue. */ next_queue = next_queue -> tx_queue_created_next; } @@ -148,7 +148,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -178,7 +178,7 @@ TX_THREAD *thread_ptr; /* Invalid message size specified. */ status = TX_SIZE_ERROR; } - + /* Check for an invalid message size - greater than 16. */ else if (message_size > TX_16_ULONG) { @@ -214,11 +214,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_queue_delete.c b/common/src/txe_queue_delete.c index df897d7f..b61b923f 100644 --- a/common/src/txe_queue_delete.c +++ b/common/src/txe_queue_delete.c @@ -101,7 +101,7 @@ TX_THREAD *thread_ptr; } else { - + /* Check for invalid caller of this function. */ /* Is the caller an ISR or Initialization? */ @@ -115,7 +115,7 @@ TX_THREAD *thread_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) diff --git a/common/src/txe_queue_flush.c b/common/src/txe_queue_flush.c index 87f3469e..611b7b51 100644 --- a/common/src/txe_queue_flush.c +++ b/common/src/txe_queue_flush.c @@ -83,7 +83,7 @@ UINT status; /* Queue pointer is invalid, return appropriate error code. */ status = TX_QUEUE_ERROR; } - + /* Now check for invalid queue ID. */ else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID) { diff --git a/common/src/txe_queue_front_send.c b/common/src/txe_queue_front_send.c index aa0361d2..ae38162f 100644 --- a/common/src/txe_queue_front_send.c +++ b/common/src/txe_queue_front_send.c @@ -114,7 +114,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -126,11 +126,11 @@ TX_THREAD *current_thread; /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } - + #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(current_thread) diff --git a/common/src/txe_queue_info_get.c b/common/src/txe_queue_info_get.c index 256c186a..f60e3d97 100644 --- a/common/src/txe_queue_info_get.c +++ b/common/src/txe_queue_info_get.c @@ -92,7 +92,7 @@ UINT status; /* Queue pointer is invalid, return appropriate error code. */ status = TX_QUEUE_ERROR; } - + /* Now check for a valid queue ID. */ else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID) { @@ -104,7 +104,7 @@ UINT status; { /* Otherwise, call the actual queue information get service. */ - status = _tx_queue_info_get(queue_ptr, name, enqueued, available_storage, first_suspended, + status = _tx_queue_info_get(queue_ptr, name, enqueued, available_storage, first_suspended, suspended_count, next_queue); } diff --git a/common/src/txe_queue_receive.c b/common/src/txe_queue_receive.c index 5373d1ef..d00e6b94 100644 --- a/common/src/txe_queue_receive.c +++ b/common/src/txe_queue_receive.c @@ -97,7 +97,7 @@ TX_THREAD *current_thread; /* Queue pointer is invalid, return appropriate error code. */ status = TX_QUEUE_ERROR; } - + /* Now check for invalid queue ID. */ else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID) { @@ -116,7 +116,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -128,7 +128,7 @@ TX_THREAD *current_thread; /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } - + #ifndef TX_TIMER_PROCESS_IN_ISR else { diff --git a/common/src/txe_queue_send.c b/common/src/txe_queue_send.c index 660ea7fe..03a6f866 100644 --- a/common/src/txe_queue_send.c +++ b/common/src/txe_queue_send.c @@ -95,7 +95,7 @@ TX_THREAD *current_thread; /* Queue pointer is invalid, return appropriate error code. */ status = TX_QUEUE_ERROR; } - + /* Now check for invalid queue ID. */ else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID) { @@ -114,7 +114,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -126,11 +126,11 @@ TX_THREAD *current_thread; /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } - + #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(current_thread) diff --git a/common/src/txe_semaphore_ceiling_put.c b/common/src/txe_semaphore_ceiling_put.c index 1cfcc7cb..7aafcd23 100644 --- a/common/src/txe_semaphore_ceiling_put.c +++ b/common/src/txe_semaphore_ceiling_put.c @@ -86,7 +86,7 @@ UINT status; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for a valid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { diff --git a/common/src/txe_semaphore_create.c b/common/src/txe_semaphore_create.c index 290cb4fb..84a047a8 100644 --- a/common/src/txe_semaphore_create.c +++ b/common/src/txe_semaphore_create.c @@ -129,12 +129,12 @@ TX_THREAD *thread_ptr; /* Determine if this semaphore matches the current semaphore in the list. */ if (semaphore_ptr == next_semaphore) { - + break; } else { - + /* Move to next semaphore. */ next_semaphore = next_semaphore -> tx_semaphore_created_next; } @@ -145,7 +145,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -163,7 +163,7 @@ TX_THREAD *thread_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) @@ -185,11 +185,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_semaphore_delete.c b/common/src/txe_semaphore_delete.c index 0b4a3293..5727119f 100644 --- a/common/src/txe_semaphore_delete.c +++ b/common/src/txe_semaphore_delete.c @@ -116,7 +116,7 @@ TX_THREAD *thread_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) diff --git a/common/src/txe_semaphore_get.c b/common/src/txe_semaphore_get.c index 90092173..f5d1209c 100644 --- a/common/src/txe_semaphore_get.c +++ b/common/src/txe_semaphore_get.c @@ -93,7 +93,7 @@ TX_THREAD *current_thread; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for invalid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { @@ -104,7 +104,7 @@ TX_THREAD *current_thread; else { - /* Check for a wait option error. Only threads are allowed any form of + /* Check for a wait option error. Only threads are allowed any form of suspension. */ if (wait_option != TX_NO_WAIT) { @@ -116,11 +116,11 @@ TX_THREAD *current_thread; /* A non-thread is trying to suspend, return appropriate error code. */ status = TX_WAIT_ERROR; } - + #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(current_thread) diff --git a/common/src/txe_semaphore_info_get.c b/common/src/txe_semaphore_info_get.c index 85fd11b9..7789ea9f 100644 --- a/common/src/txe_semaphore_info_get.c +++ b/common/src/txe_semaphore_info_get.c @@ -78,8 +78,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, - TX_THREAD **first_suspended, ULONG *suspended_count, +UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_SEMAPHORE **next_semaphore) { @@ -93,7 +93,7 @@ UINT status; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for a valid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { @@ -105,7 +105,7 @@ UINT status; { /* Otherwise, call the actual semaphore information get service. */ - status = _tx_semaphore_info_get(semaphore_ptr, name, current_value, first_suspended, + status = _tx_semaphore_info_get(semaphore_ptr, name, current_value, first_suspended, suspended_count, next_semaphore); } diff --git a/common/src/txe_semaphore_prioritize.c b/common/src/txe_semaphore_prioritize.c index 3672a485..b00c82d4 100644 --- a/common/src/txe_semaphore_prioritize.c +++ b/common/src/txe_semaphore_prioritize.c @@ -82,7 +82,7 @@ UINT status; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for a valid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { diff --git a/common/src/txe_semaphore_put.c b/common/src/txe_semaphore_put.c index 42b00240..591026ed 100644 --- a/common/src/txe_semaphore_put.c +++ b/common/src/txe_semaphore_put.c @@ -82,7 +82,7 @@ UINT status; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for invalid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { diff --git a/common/src/txe_semaphore_put_notify.c b/common/src/txe_semaphore_put_notify.c index b6faa50e..f73e1f99 100644 --- a/common/src/txe_semaphore_put_notify.c +++ b/common/src/txe_semaphore_put_notify.c @@ -85,7 +85,7 @@ UINT status; /* Semaphore pointer is invalid, return appropriate error code. */ status = TX_SEMAPHORE_ERROR; } - + /* Now check for invalid semaphore ID. */ else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID) { diff --git a/common/src/txe_thread_create.c b/common/src/txe_thread_create.c index 9eaa7b27..75f5e660 100644 --- a/common/src/txe_thread_create.c +++ b/common/src/txe_thread_create.c @@ -87,9 +87,9 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, +UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG id), ULONG entry_input, - VOID *stack_start, ULONG stack_size, + VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start, UINT thread_control_block_size) { @@ -145,19 +145,19 @@ TX_THREAD *current_thread; stack_end = TX_UCHAR_TO_VOID_POINTER_CONVERT(work_ptr); for (i = ((ULONG) 0); i < _tx_thread_created_count; i++) { - + /* Determine if this thread matches the thread in the list. */ if (thread_ptr == next_thread) { - + /* Set the break flag. */ break_flag = TX_TRUE; } - + /* Determine if we need to break the loop. */ if (break_flag == TX_TRUE) { - + /* Yes, break out of the loop. */ break; } @@ -168,11 +168,11 @@ TX_THREAD *current_thread; if (stack_start < next_thread -> tx_thread_stack_end) { - - /* This stack overlaps with an existing thread, clear the stack pointer to + + /* This stack overlaps with an existing thread, clear the stack pointer to force a stack error below. */ stack_start = TX_NULL; - + /* Set the break flag. */ break_flag = TX_TRUE; } @@ -184,11 +184,11 @@ TX_THREAD *current_thread; if (stack_end < next_thread -> tx_thread_stack_end) { - - /* This stack overlaps with an existing thread, clear the stack pointer to + + /* This stack overlaps with an existing thread, clear the stack pointer to force a stack error below. */ stack_start = TX_NULL; - + /* Set the break flag. */ break_flag = TX_TRUE; } @@ -203,7 +203,7 @@ TX_THREAD *current_thread; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -285,11 +285,11 @@ TX_THREAD *current_thread; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_thread_entry_exit_notify.c b/common/src/txe_thread_entry_exit_notify.c index 84e359e0..0dec7dba 100644 --- a/common/src/txe_thread_entry_exit_notify.c +++ b/common/src/txe_thread_entry_exit_notify.c @@ -85,7 +85,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_thread_info_get.c b/common/src/txe_thread_info_get.c index 5cd51539..6d0e594f 100644 --- a/common/src/txe_thread_info_get.c +++ b/common/src/txe_thread_info_get.c @@ -82,8 +82,8 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, - UINT *priority, UINT *preemption_threshold, ULONG *time_slice, +UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, + UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread) { @@ -97,7 +97,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { @@ -109,7 +109,7 @@ UINT status; { /* Call the actual thread information get service. */ - status = _tx_thread_info_get(thread_ptr, name, state, run_count, priority, preemption_threshold, + status = _tx_thread_info_get(thread_ptr, name, state, run_count, priority, preemption_threshold, time_slice, next_thread, next_suspended_thread); } diff --git a/common/src/txe_thread_preemption_change.c b/common/src/txe_thread_preemption_change.c index ab813372..8cfee279 100644 --- a/common/src/txe_thread_preemption_change.c +++ b/common/src/txe_thread_preemption_change.c @@ -87,7 +87,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_thread_priority_change.c b/common/src/txe_thread_priority_change.c index 5e0bda5c..fcccbc43 100644 --- a/common/src/txe_thread_priority_change.c +++ b/common/src/txe_thread_priority_change.c @@ -88,7 +88,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { @@ -108,7 +108,7 @@ UINT status; /* Determine if the priority is legal. */ else if (new_priority >= ((UINT) TX_MAX_PRIORITIES)) { - + /* Return an error status. */ status = TX_PRIORITY_ERROR; } diff --git a/common/src/txe_thread_relinquish.c b/common/src/txe_thread_relinquish.c index 09569fe3..f0a6ea83 100644 --- a/common/src/txe_thread_relinquish.c +++ b/common/src/txe_thread_relinquish.c @@ -85,7 +85,7 @@ TX_THREAD *current_thread; /* Now make sure the call is not from an ISR or Initialization. */ if (TX_THREAD_GET_SYSTEM_STATE() == ((ULONG) 0)) { - + /* Okay to call the real relinquish function. */ _tx_thread_relinquish(); } diff --git a/common/src/txe_thread_reset.c b/common/src/txe_thread_reset.c index 59a1a806..18f962ac 100644 --- a/common/src/txe_thread_reset.c +++ b/common/src/txe_thread_reset.c @@ -51,7 +51,7 @@ /* OUTPUT */ /* */ /* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ +/* TX_CALLER_ERROR Invalid caller of function */ /* status Service return status */ /* */ /* CALLS */ @@ -90,7 +90,7 @@ TX_THREAD *current_thread; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for an invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { @@ -118,12 +118,12 @@ TX_THREAD *current_thread; /* Check for interrupt or initialization call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) { - + /* Invalid caller of this function, return appropriate error code. */ status = TX_CALLER_ERROR; } } - + /* Determine if everything is okay. */ if (status == TX_SUCCESS) { diff --git a/common/src/txe_thread_resume.c b/common/src/txe_thread_resume.c index 20b1b124..33a9abe9 100644 --- a/common/src/txe_thread_resume.c +++ b/common/src/txe_thread_resume.c @@ -82,7 +82,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_thread_terminate.c b/common/src/txe_thread_terminate.c index 2c4ab926..0865c677 100644 --- a/common/src/txe_thread_terminate.c +++ b/common/src/txe_thread_terminate.c @@ -85,7 +85,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_thread_time_slice_change.c b/common/src/txe_thread_time_slice_change.c index a4b4df83..be68afb3 100644 --- a/common/src/txe_thread_time_slice_change.c +++ b/common/src/txe_thread_time_slice_change.c @@ -87,7 +87,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_thread_wait_abort.c b/common/src/txe_thread_wait_abort.c index 45dc9394..9482e809 100644 --- a/common/src/txe_thread_wait_abort.c +++ b/common/src/txe_thread_wait_abort.c @@ -82,7 +82,7 @@ UINT status; /* Thread pointer is invalid, return appropriate error code. */ status = TX_THREAD_ERROR; } - + /* Now check for invalid thread ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { diff --git a/common/src/txe_timer_activate.c b/common/src/txe_timer_activate.c index 76a8062e..9a50e39e 100644 --- a/common/src/txe_timer_activate.c +++ b/common/src/txe_timer_activate.c @@ -83,7 +83,7 @@ UINT status; /* Timer pointer is invalid, return appropriate error code. */ status = TX_TIMER_ERROR; } - + /* Now check for invalid timer ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { diff --git a/common/src/txe_timer_change.c b/common/src/txe_timer_change.c index a13affcb..d6db7755 100644 --- a/common/src/txe_timer_change.c +++ b/common/src/txe_timer_change.c @@ -89,7 +89,7 @@ UINT status; /* Timer pointer is invalid, return appropriate error code. */ status = TX_TIMER_ERROR; } - + /* Now check for invalid timer ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { @@ -119,7 +119,7 @@ UINT status; /* Call actual application timer function. */ status = _tx_timer_change(timer_ptr, initial_ticks, reschedule_ticks); } - + /* Return completion status. */ return(status); } diff --git a/common/src/txe_timer_create.c b/common/src/txe_timer_create.c index 7d7d469f..de08c053 100644 --- a/common/src/txe_timer_create.c +++ b/common/src/txe_timer_create.c @@ -82,7 +82,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, +UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG id), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size) { @@ -107,7 +107,7 @@ TX_THREAD *thread_ptr; /* Timer pointer is invalid, return appropriate error code. */ status = TX_TIMER_ERROR; } - + /* Now check for invalid control block size. */ else if (timer_control_block_size != (sizeof(TX_TIMER))) { @@ -135,12 +135,12 @@ TX_THREAD *thread_ptr; /* Determine if this timer matches the current timer in the list. */ if (timer_ptr == next_timer) { - + break; } else { - + /* Move to next timer. */ next_timer = next_timer -> tx_timer_created_next; } @@ -151,7 +151,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -179,11 +179,11 @@ TX_THREAD *thread_ptr; /* Check for an illegal activation. */ if (auto_activate != TX_AUTO_ACTIVATE) { - + /* And activation is not the other value. */ if (auto_activate != TX_NO_ACTIVATE) { - + /* Invalid activation selected, return appropriate error code. */ status = TX_ACTIVATE_ERROR; } @@ -212,11 +212,11 @@ TX_THREAD *thread_ptr; /* Check for interrupt call. */ if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 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. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_timer_deactivate.c b/common/src/txe_timer_deactivate.c index b6ddcd24..d5379001 100644 --- a/common/src/txe_timer_deactivate.c +++ b/common/src/txe_timer_deactivate.c @@ -93,7 +93,7 @@ UINT status; } else { - + /* Call actual application timer deactivate function. */ status = _tx_timer_deactivate(timer_ptr); } diff --git a/common/src/txe_timer_delete.c b/common/src/txe_timer_delete.c index 29a40683..0502efd2 100644 --- a/common/src/txe_timer_delete.c +++ b/common/src/txe_timer_delete.c @@ -86,14 +86,14 @@ TX_THREAD *thread_ptr; /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid timer pointer. */ if (timer_ptr == TX_NULL) { /* Timer pointer is invalid, return appropriate error code. */ status = TX_TIMER_ERROR; } - + /* Now check for invalid timer ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { @@ -121,7 +121,7 @@ TX_THREAD *thread_ptr; /* Is the caller the system timer thread? */ if (thread_ptr == &_tx_timer_thread) { - + /* Invalid caller of this function, return appropriate error code. */ status = TX_CALLER_ERROR; } diff --git a/common/src/txe_timer_info_get.c b/common/src/txe_timer_info_get.c index d4840e67..b2865983 100644 --- a/common/src/txe_timer_info_get.c +++ b/common/src/txe_timer_info_get.c @@ -77,7 +77,7 @@ /* resulting in version 6.1 */ /* */ /**************************************************************************/ -UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, +UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, ULONG *reschedule_ticks, TX_TIMER **next_timer) { @@ -91,7 +91,7 @@ UINT status; /* Timer pointer is invalid, return appropriate error code. */ status = TX_TIMER_ERROR; } - + /* Now check for invalid timer ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { |
