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_smp/src | |
| parent | 215df45d4b59d4ce8606a88f566d1d426e64a84c (diff) | |
Release 6.1.9
Diffstat (limited to 'common_smp/src')
194 files changed, 8998 insertions, 8655 deletions
diff --git a/common_smp/src/tx_block_allocate.c b/common_smp/src/tx_block_allocate.c index b27737b8..ad00c34a 100644 --- a/common_smp/src/tx_block_allocate.c +++ b/common_smp/src/tx_block_allocate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -33,46 +33,48 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_allocate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_allocate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function allocates a block from the specified memory block */ -/* pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* block_ptr Pointer to place allocated block */ +/* */ +/* This function allocates a block from the specified memory block */ +/* pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* block_ptr Pointer to place allocated block */ /* pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Suspend thread */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option) @@ -80,9 +82,9 @@ UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_o TX_INTERRUPT_SAVE_AREA -UINT status; -TX_THREAD *thread_ptr; -UCHAR *work_ptr; +UINT status; +TX_THREAD *thread_ptr; +UCHAR *work_ptr; UCHAR *temp_ptr; UCHAR **next_block_ptr; UCHAR **return_ptr; @@ -157,7 +159,7 @@ ULONG lower_tbu; work_ptr = pool_ptr -> tx_block_pool_available_list; /* Return the first available block to the caller. */ - temp_ptr = TX_UCHAR_POINTER_ADD(work_ptr, (sizeof(UCHAR *))); + temp_ptr = TX_UCHAR_POINTER_ADD(work_ptr, (sizeof(UCHAR *))); return_ptr = TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(block_ptr); *return_ptr = temp_ptr; @@ -168,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 @@ -180,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); @@ -198,7 +200,7 @@ ULONG lower_tbu; /* Set status to success. */ status = TX_SUCCESS; - + /* Restore interrupts. */ TX_RESTORE } @@ -227,7 +229,7 @@ ULONG lower_tbu; { /* Prepare for suspension of this thread. */ - + #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO /* Increment the total suspensions counter. */ @@ -259,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)++; @@ -320,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_smp/src/tx_block_pool_cleanup.c b/common_smp/src/tx_block_pool_cleanup.c index 8b37c8af..12b4dcbd 100644 --- a/common_smp/src/tx_block_pool_cleanup.c +++ b/common_smp/src/tx_block_pool_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -30,47 +30,49 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes block allocate timeout and thread terminate */ -/* actions that require the block pool data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes block allocate timeout and thread terminate */ +/* actions that require the block pool data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_block_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,12 +82,12 @@ VOID _tx_block_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_BLOCK_POOL *pool_ptr; +TX_BLOCK_POOL *pool_ptr; 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. */ @@ -94,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) { @@ -105,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) { @@ -131,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; } @@ -155,18 +157,18 @@ 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; } - } - + } + /* 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_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_smp/src/tx_block_pool_create.c b/common_smp/src/tx_block_pool_create.c index 3f3beb75..2b9cdbcf 100644 --- a/common_smp/src/tx_block_pool_create.c +++ b/common_smp/src/tx_block_pool_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -30,46 +30,48 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a pool of fixed-size memory blocks in the */ -/* specified memory area. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* name_ptr Pointer to block pool name */ -/* block_size Number of bytes in each block */ -/* pool_start Address of beginning of pool area */ -/* pool_size Number of bytes in the block pool */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a pool of fixed-size memory blocks in the */ +/* specified memory area. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* name_ptr Pointer to block pool name */ +/* block_size Number of bytes in each block */ +/* pool_start Address of beginning of pool area */ +/* pool_size Number of bytes in the block pool */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, @@ -78,12 +80,12 @@ UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block TX_INTERRUPT_SAVE_AREA -UINT blocks; +UINT blocks; UINT status; ULONG total_blocks; -UCHAR *block_ptr; +UCHAR *block_ptr; UCHAR **block_link_ptr; -UCHAR *next_block_ptr; +UCHAR *next_block_ptr; TX_BLOCK_POOL *next_pool; TX_BLOCK_POOL *previous_pool; @@ -95,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)); @@ -104,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 *))); @@ -143,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); @@ -178,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++; @@ -206,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_smp/src/tx_block_pool_delete.c b/common_smp/src/tx_block_pool_delete.c index 87086e53..e6d7491c 100644 --- a/common_smp/src/tx_block_pool_delete.c +++ b/common_smp/src/tx_block_pool_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -31,45 +31,47 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified block pool. All threads */ -/* suspended on the block pool are resumed with the TX_DELETED status */ -/* code. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified block pool. All threads */ +/* suspended on the block pool are resumed with the TX_DELETED status */ +/* code. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr) @@ -77,7 +79,7 @@ UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; UINT suspended_count; TX_BLOCK_POOL *next_pool; @@ -124,9 +126,9 @@ 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; + _tx_block_pool_created_ptr = next_pool; } } @@ -134,7 +136,7 @@ TX_BLOCK_POOL *previous_pool; _tx_thread_preempt_disable++; /* Pickup the suspension information. */ - thread_ptr = pool_ptr -> tx_block_pool_suspension_list; + thread_ptr = pool_ptr -> tx_block_pool_suspension_list; pool_ptr -> tx_block_pool_suspension_list = TX_NULL; suspended_count = pool_ptr -> tx_block_pool_suspended_count; pool_ptr -> tx_block_pool_suspended_count = TX_NO_SUSPENSIONS; @@ -146,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_smp/src/tx_block_pool_info_get.c b/common_smp/src/tx_block_pool_info_get.c index 1564e6dd..4837f45b 100644 --- a/common_smp/src/tx_block_pool_info_get.c +++ b/common_smp/src/tx_block_pool_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Memory */ /** */ @@ -30,53 +30,55 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified block pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to block pool control blk */ -/* name Destination for the pool name */ -/* available_blocks Number of free blocks in pool */ -/* total_blocks Total number of blocks in pool */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on block pool */ -/* suspended_count Destination for suspended count */ -/* next_pool Destination for pointer to next */ -/* block pool on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified block pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to block pool control blk */ +/* name Destination for the pool name */ +/* available_blocks Number of free blocks in pool */ +/* total_blocks Total number of blocks in pool */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on block pool */ +/* suspended_count Destination for suspended count */ +/* next_pool Destination for pointer to next */ +/* block pool on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -98,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_smp/src/tx_block_pool_initialize.c b/common_smp/src/tx_block_pool_initialize.c index 9494a0e3..ae062a49 100644 --- a/common_smp/src/tx_block_pool_initialize.c +++ b/common_smp/src/tx_block_pool_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -67,42 +67,47 @@ ULONG _tx_block_pool_performance_timeout_count; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block pool_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block pool_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the block pool component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the block pool component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_block_pool_initialize(VOID) diff --git a/common_smp/src/tx_block_pool_performance_info_get.c b/common_smp/src/tx_block_pool_performance_info_get.c index 5a41661e..71112031 100644 --- a/common_smp/src/tx_block_pool_performance_info_get.c +++ b/common_smp/src/tx_block_pool_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Memory */ /** */ @@ -32,50 +32,52 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* block pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to block pool control blk */ -/* allocates Destination for the number of */ -/* allocations from this pool */ -/* releases Destination for the number of */ -/* blocks released back to pool */ -/* suspensions Destination for number of */ -/* suspensions on this pool */ -/* timeouts Destination for number of timeouts*/ -/* on this pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves performance information from the specified */ +/* block pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to block pool control blk */ +/* allocates Destination for the number of */ +/* allocations from this pool */ +/* releases Destination for the number of */ +/* blocks released back to pool */ +/* suspensions Destination for number of */ +/* suspensions on this pool */ +/* timeouts Destination for number of timeouts*/ +/* on this pool */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases, @@ -91,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; } @@ -99,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 @@ -121,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; } @@ -155,7 +157,7 @@ UINT status; #else UINT status; - + /* Access input arguments just for the sake of lint, MISRA, etc. */ if (pool_ptr != TX_NULL) { @@ -189,7 +191,7 @@ UINT status; } else { - + /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common_smp/src/tx_block_pool_performance_system_info_get.c b/common_smp/src/tx_block_pool_performance_system_info_get.c index 300fd8fe..4842bc93 100644 --- a/common_smp/src/tx_block_pool_performance_system_info_get.c +++ b/common_smp/src/tx_block_pool_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Memory */ /** */ @@ -31,48 +31,50 @@ #include "tx_trace.h" #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves block pool performance information. */ -/* */ -/* INPUT */ -/* */ -/* allocates Destination for the total number */ -/* of block allocations */ -/* releases Destination for the total number */ -/* of blocks released */ -/* suspensions Destination for the total number */ -/* of suspensions */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves block pool performance information. */ +/* */ +/* INPUT */ +/* */ +/* allocates Destination for the total number */ +/* of block allocations */ +/* releases Destination for the total number */ +/* of blocks released */ +/* suspensions Destination for the total number */ +/* of suspensions */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, ULONG *suspensions, ULONG *timeouts) @@ -98,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; } @@ -137,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_smp/src/tx_block_pool_prioritize.c b/common_smp/src/tx_block_pool_prioritize.c index 92c75eaa..551b2019 100644 --- a/common_smp/src/tx_block_pool_prioritize.c +++ b/common_smp/src/tx_block_pool_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -31,43 +31,45 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the highest priority suspended thread at the */ -/* front of the suspension list. All other threads remain in the same */ -/* FIFO suspension order. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the highest priority suspended thread at the */ +/* front of the suspension list. All other threads remain in the same */ +/* FIFO suspension order. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr) @@ -75,8 +77,8 @@ UINT _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *priority_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *priority_thread_ptr; TX_THREAD *head_ptr; UINT suspended_count; TX_THREAD *next_thread; @@ -123,12 +125,12 @@ UINT list_changed; /* Restore interrupts. */ TX_RESTORE } - else + else { /* 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; @@ -140,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 { @@ -157,34 +159,34 @@ UINT list_changed; TX_RESTORE /* Disable interrupts again. */ - TX_DISABLE - - /* Determine if any changes to the list have occurred while + TX_DISABLE + + /* 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; } @@ -200,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; } @@ -210,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_smp/src/tx_block_release.c b/common_smp/src/tx_block_release.c index bb610900..6ac34664 100644 --- a/common_smp/src/tx_block_release.c +++ b/common_smp/src/tx_block_release.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -31,43 +31,45 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_release PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_release PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns a previously allocated block to its */ -/* associated memory block pool. */ -/* */ -/* INPUT */ -/* */ -/* block_ptr Pointer to memory block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function returns a previously allocated block to its */ +/* associated memory block pool. */ +/* */ +/* INPUT */ +/* */ +/* block_ptr Pointer to memory block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_block_release(VOID *block_ptr) @@ -75,9 +77,9 @@ UINT _tx_block_release(VOID *block_ptr) TX_INTERRUPT_SAVE_AREA -TX_BLOCK_POOL *pool_ptr; -TX_THREAD *thread_ptr; -UCHAR *work_ptr; +TX_BLOCK_POOL *pool_ptr; +TX_THREAD *thread_ptr; +UCHAR *work_ptr; UCHAR **return_block_ptr; UCHAR **next_block_ptr; UINT suspended_count; @@ -88,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 *))); @@ -119,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); @@ -145,8 +147,8 @@ 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; - } - + } + /* Prepare for resumption of the first thread. */ /* Clear cleanup routine to avoid timeout. */ @@ -159,7 +161,7 @@ TX_THREAD *previous_thread; *return_block_ptr = work_ptr; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -189,7 +191,7 @@ TX_THREAD *previous_thread; *next_block_ptr = pool_ptr -> tx_block_pool_available_list; /* Adjust the head pointer. */ - pool_ptr -> tx_block_pool_available_list = work_ptr; + pool_ptr -> tx_block_pool_available_list = work_ptr; /* Increment the count of available blocks. */ pool_ptr -> tx_block_pool_available++; diff --git a/common_smp/src/tx_byte_allocate.c b/common_smp/src/tx_byte_allocate.c index 427ad9e0..be7e28c4 100644 --- a/common_smp/src/tx_byte_allocate.c +++ b/common_smp/src/tx_byte_allocate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -33,48 +33,50 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_allocate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_allocate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function allocates bytes from the specified memory byte */ -/* pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* memory_ptr Pointer to place allocated bytes */ +/* */ +/* This function allocates bytes from the specified memory byte */ +/* pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* memory_ptr Pointer to place allocated bytes */ /* pointer */ -/* memory_size Number of bytes to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread service */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* _tx_byte_pool_search Search byte pool for memory */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* memory_size Number of bytes to allocate */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Suspend thread service */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* _tx_byte_pool_search Search byte pool for memory */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, ULONG wait_option) @@ -82,9 +84,9 @@ UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_ TX_INTERRUPT_SAVE_AREA -UINT status; -TX_THREAD *thread_ptr; -UCHAR *work_ptr; +UINT status; +TX_THREAD *thread_ptr; +UCHAR *work_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -179,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; } @@ -215,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); @@ -240,7 +242,7 @@ ULONG lower_tbu; /* Restore interrupts. */ TX_RESTORE - + /* Set the status to success. */ status = TX_SUCCESS; } @@ -302,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) { @@ -364,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); @@ -394,7 +396,7 @@ ULONG lower_tbu; } else { - + /* Restore interrupts. */ TX_RESTORE diff --git a/common_smp/src/tx_byte_pool_cleanup.c b/common_smp/src/tx_byte_pool_cleanup.c index 1ad620ce..e8cd1a0e 100644 --- a/common_smp/src/tx_byte_pool_cleanup.c +++ b/common_smp/src/tx_byte_pool_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -30,47 +30,49 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes byte allocate timeout and thread terminate */ -/* actions that require the byte pool data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes byte allocate timeout and thread terminate */ +/* actions that require the byte pool data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_byte_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,12 +82,12 @@ VOID _tx_byte_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_BYTE_POOL *pool_ptr; +TX_BYTE_POOL *pool_ptr; 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. */ @@ -94,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) { @@ -105,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) { @@ -124,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; } @@ -153,18 +155,18 @@ 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; } - } - + } + /* 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_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 @@ -199,7 +201,7 @@ TX_THREAD *previous_thread; #endif } #ifndef TX_NOT_INTERRUPTABLE - } + } } } } diff --git a/common_smp/src/tx_byte_pool_create.c b/common_smp/src/tx_byte_pool_create.c index 4819f7a8..ffd35e54 100644 --- a/common_smp/src/tx_byte_pool_create.c +++ b/common_smp/src/tx_byte_pool_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Pool */ /** */ @@ -30,45 +30,47 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a pool of memory bytes in the specified */ -/* memory area. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* name_ptr Pointer to byte pool name */ -/* pool_start Address of beginning of pool area */ -/* pool_size Number of bytes in the byte pool */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a pool of memory bytes in the specified */ +/* memory area. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* name_ptr Pointer to byte pool name */ +/* pool_start Address of beginning of pool area */ +/* pool_size Number of bytes in the byte pool */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size) @@ -76,7 +78,7 @@ UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_st TX_INTERRUPT_SAVE_AREA -UCHAR *block_ptr; +UCHAR *block_ptr; UCHAR **block_indirect_ptr; UCHAR *temp_ptr; TX_BYTE_POOL *next_pool; @@ -87,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)); @@ -102,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); @@ -120,7 +122,7 @@ ALIGN_TYPE *free_ptr; /* Backup the end of the pool pointer and build the pre-allocated block. */ block_ptr = TX_UCHAR_POINTER_SUB(block_ptr, (sizeof(ALIGN_TYPE))); - /* Cast the pool pointer into a ULONG. */ + /* Cast the pool pointer into a ULONG. */ temp_ptr = TX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(pool_ptr); block_indirect_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr); *block_indirect_ptr = temp_ptr; @@ -170,12 +172,12 @@ ALIGN_TYPE *free_ptr; /* Setup this byte pool's created links. */ pool_ptr -> tx_byte_pool_created_previous = previous_pool; - pool_ptr -> tx_byte_pool_created_next = next_pool; + pool_ptr -> tx_byte_pool_created_next = next_pool; } /* 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_smp/src/tx_byte_pool_delete.c b/common_smp/src/tx_byte_pool_delete.c index 8595ec1f..1d8a3fa7 100644 --- a/common_smp/src/tx_byte_pool_delete.c +++ b/common_smp/src/tx_byte_pool_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Pool */ /** */ @@ -31,49 +31,51 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified byte pool. All threads */ -/* suspended on the byte pool are resumed with the TX_DELETED status */ -/* code. */ -/* */ -/* It is important to note that the byte pool being deleted, or the */ -/* memory associated with it should not be in use when this function */ -/* is called. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified byte pool. All threads */ +/* suspended on the byte pool are resumed with the TX_DELETED status */ +/* code. */ +/* */ +/* It is important to note that the byte pool being deleted, or the */ +/* memory associated with it should not be in use when this function */ +/* is called. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr) @@ -81,8 +83,8 @@ UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *next_thread; +TX_THREAD *thread_ptr; +TX_THREAD *next_thread; UINT suspended_count; TX_BYTE_POOL *next_pool; TX_BYTE_POOL *previous_pool; @@ -108,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) { @@ -128,9 +130,9 @@ 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; + _tx_byte_pool_created_ptr = next_pool; } } @@ -138,11 +140,11 @@ TX_BYTE_POOL *previous_pool; _tx_thread_preempt_disable++; /* Pickup the suspension information. */ - thread_ptr = pool_ptr -> tx_byte_pool_suspension_list; + thread_ptr = pool_ptr -> tx_byte_pool_suspension_list; 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 @@ -150,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_smp/src/tx_byte_pool_info_get.c b/common_smp/src/tx_byte_pool_info_get.c index c5b18b07..b13e8e31 100644 --- a/common_smp/src/tx_byte_pool_info_get.c +++ b/common_smp/src/tx_byte_pool_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -30,53 +30,55 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified byte pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to byte pool control block*/ -/* name Destination for the pool name */ -/* available_bytes Number of free bytes in byte pool */ -/* fragments Number of fragments in byte pool */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on byte pool */ -/* suspended_count Destination for suspended count */ -/* next_pool Destination for pointer to next */ -/* byte pool on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified byte pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to byte pool control block*/ +/* name Destination for the pool name */ +/* available_bytes Number of free bytes in byte pool */ +/* fragments Number of fragments in byte pool */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on byte pool */ +/* suspended_count Destination for suspended count */ +/* next_pool Destination for pointer to next */ +/* byte pool on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -98,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_smp/src/tx_byte_pool_initialize.c b/common_smp/src/tx_byte_pool_initialize.c index f77b33c5..92b6b106 100644 --- a/common_smp/src/tx_byte_pool_initialize.c +++ b/common_smp/src/tx_byte_pool_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Pool */ /** */ @@ -82,42 +82,47 @@ ULONG _tx_byte_pool_performance_timeout_count; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the byte pool component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the byte pool component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_byte_pool_initialize(VOID) diff --git a/common_smp/src/tx_byte_pool_performance_info_get.c b/common_smp/src/tx_byte_pool_performance_info_get.c index e78eb356..c3f685fd 100644 --- a/common_smp/src/tx_byte_pool_performance_info_get.c +++ b/common_smp/src/tx_byte_pool_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -32,58 +32,60 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* byte pool. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to byte pool control block*/ -/* allocates Destination for number of */ -/* allocates on this pool */ -/* releases Destination for number of */ -/* releases on this pool */ -/* fragments_searched Destination for number of */ -/* fragments searched during */ -/* allocation */ -/* merges Destination for number of adjacent*/ -/* free fragments merged */ -/* splits Destination for number of */ -/* fragments split during */ -/* allocation */ -/* suspensions Destination for number of */ +/* */ +/* This function retrieves performance information from the specified */ +/* byte pool. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to byte pool control block*/ +/* allocates Destination for number of */ +/* allocates on this pool */ +/* releases Destination for number of */ +/* releases on this pool */ +/* fragments_searched Destination for number of */ +/* fragments searched during */ +/* allocation */ +/* merges Destination for number of adjacent*/ +/* free fragments merged */ +/* splits Destination for number of */ +/* fragments split during */ +/* allocation */ +/* suspensions Destination for number of */ /* suspensions on this pool */ -/* timeouts Destination for number of timeouts*/ -/* on this byte pool */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* timeouts Destination for number of timeouts*/ +/* on this byte pool */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases, @@ -100,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; } @@ -130,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; } @@ -144,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; } @@ -182,7 +184,7 @@ UINT status; /* Return completion status. */ status = TX_SUCCESS; } - + /* Return completion status. */ return(status); #else @@ -193,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_smp/src/tx_byte_pool_performance_system_info_get.c b/common_smp/src/tx_byte_pool_performance_system_info_get.c index 6f2bce3e..4d804952 100644 --- a/common_smp/src/tx_byte_pool_performance_system_info_get.c +++ b/common_smp/src/tx_byte_pool_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -31,56 +31,58 @@ #include "tx_trace.h" #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves byte pool performance information. */ -/* */ -/* INPUT */ -/* */ -/* allocates Destination for total number of */ -/* allocates */ -/* releases Destination for total number of */ -/* releases */ -/* fragments_searched Destination for total number of */ -/* fragments searched during */ -/* allocation */ -/* merges Destination for total number of */ -/* adjacent free fragments merged */ -/* splits Destination for total number of */ -/* fragments split during */ -/* allocation */ -/* suspensions Destination for total number of */ +/* */ +/* This function retrieves byte pool performance information. */ +/* */ +/* INPUT */ +/* */ +/* allocates Destination for total number of */ +/* allocates */ +/* releases Destination for total number of */ +/* releases */ +/* fragments_searched Destination for total number of */ +/* fragments searched during */ +/* allocation */ +/* merges Destination for total number of */ +/* adjacent free fragments merged */ +/* splits Destination for total number of */ +/* fragments split during */ +/* allocation */ +/* suspensions Destination for total number of */ /* suspensions */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, @@ -107,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; @@ -213,7 +215,7 @@ UINT status; /* Not enabled, return error. */ status = TX_FEATURE_NOT_ENABLED; } - + /* Return completion status. */ return(status); #endif diff --git a/common_smp/src/tx_byte_pool_prioritize.c b/common_smp/src/tx_byte_pool_prioritize.c index a72d6290..30f273e8 100644 --- a/common_smp/src/tx_byte_pool_prioritize.c +++ b/common_smp/src/tx_byte_pool_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -31,43 +31,45 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the highest priority suspended thread at the */ -/* front of the suspension list. All other threads remain in the same */ -/* FIFO suspension order. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the highest priority suspended thread at the */ +/* front of the suspension list. All other threads remain in the same */ +/* FIFO suspension order. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr) @@ -75,8 +77,8 @@ UINT _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *priority_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *priority_thread_ptr; TX_THREAD *head_ptr; UINT suspended_count; TX_THREAD *next_thread; @@ -123,7 +125,7 @@ UINT list_changed; /* Restore interrupts. */ TX_RESTORE } - else + else { /* Remember the suspension count and head pointer. */ @@ -159,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) { @@ -210,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_smp/src/tx_byte_pool_search.c b/common_smp/src/tx_byte_pool_search.c index bd2b959f..c40247f3 100644 --- a/common_smp/src/tx_byte_pool_search.c +++ b/common_smp/src/tx_byte_pool_search.c @@ -259,23 +259,23 @@ UINT blocks_searched = ((UINT) 0); #ifdef TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH - /* When this is enabled, multiple blocks are searched while holding the protection. */ + /* When this is enabled, multiple blocks are searched while holding the protection. */ /* Increment the number of blocks searched. */ blocks_searched = blocks_searched + ((UINT) 1); - + /* Have we reached the maximum number of blocks to search while holding the protection? */ - if (blocks_searched >= ((UINT) TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH)) + if (blocks_searched >= ((UINT) TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH)) { /* Yes, we have exceeded the multiple block search limit. */ - + /* Restore interrupts temporarily. */ TX_RESTORE - + /* Disable interrupts. */ TX_DISABLE - + /* Reset the number of blocks searched counter. */ blocks_searched = ((UINT) 0); } @@ -295,10 +295,10 @@ UINT blocks_searched = ((UINT) 0); { /* Restore interrupts temporarily. */ TX_RESTORE - + /* Increment the delay counter. */ delay_count++; - + /* Disable interrupts. */ TX_DISABLE } while (delay_count < ((ULONG) TX_BYTE_POOL_DELAY_VALUE)); diff --git a/common_smp/src/tx_byte_release.c b/common_smp/src/tx_byte_release.c index 7b8b50d8..2d1dc7bb 100644 --- a/common_smp/src/tx_byte_release.c +++ b/common_smp/src/tx_byte_release.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -31,45 +31,47 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_release PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_release PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns previously allocated memory to its */ -/* associated memory byte pool. */ -/* */ -/* INPUT */ -/* */ -/* memory_ptr Pointer to allocated memory */ -/* */ -/* OUTPUT */ -/* */ -/* [TX_PTR_ERROR | TX_SUCCESS] Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_byte_pool_search Search the byte pool for memory */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function returns previously allocated memory to its */ +/* associated memory byte pool. */ +/* */ +/* INPUT */ +/* */ +/* memory_ptr Pointer to allocated memory */ +/* */ +/* OUTPUT */ +/* */ +/* [TX_PTR_ERROR | TX_SUCCESS] Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_byte_pool_search Search the byte pool for memory */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_byte_release(VOID *memory_ptr) @@ -78,12 +80,12 @@ UINT _tx_byte_release(VOID *memory_ptr) TX_INTERRUPT_SAVE_AREA UINT status; -TX_BYTE_POOL *pool_ptr; -TX_THREAD *thread_ptr; -UCHAR *work_ptr; +TX_BYTE_POOL *pool_ptr; +TX_THREAD *thread_ptr; +UCHAR *work_ptr; UCHAR *temp_ptr; UCHAR *next_block_ptr; -TX_THREAD *susp_thread_ptr; +TX_THREAD *susp_thread_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -96,7 +98,7 @@ UCHAR **suspend_info_ptr; /* Default to successful status. */ status = TX_SUCCESS; - + /* Set the pool pointer to NULL. */ pool_ptr = TX_NULL; @@ -107,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)))); @@ -125,20 +127,20 @@ UCHAR **suspend_info_ptr; /* See if we have a valid pool pointer. */ if (pool_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_PTR_ERROR; } - else + else { /* 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; } @@ -161,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. */ @@ -199,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. */ @@ -213,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) { @@ -229,7 +231,7 @@ UCHAR **suspend_info_ptr; TX_RESTORE /* See if the request can be satisfied. */ - work_ptr = _tx_byte_pool_search(pool_ptr, memory_size); + work_ptr = _tx_byte_pool_search(pool_ptr, memory_size); /* Optional processing extension. */ TX_BYTE_RELEASE_EXTENSION @@ -243,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; } @@ -255,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. */ @@ -286,8 +288,8 @@ UCHAR **suspend_info_ptr; previous_thread = susp_thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Prepare for resumption of the thread. */ /* Clear cleanup routine to avoid timeout. */ @@ -300,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; @@ -326,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 @@ -343,19 +345,19 @@ 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. */ if (work_ptr < (pool_ptr -> tx_byte_pool_search)) - { + { /* Yes, update the search pointer. */ pool_ptr -> tx_byte_pool_search = work_ptr; } } } - + /* Restore interrupts. */ TX_RESTORE @@ -364,7 +366,7 @@ UCHAR **suspend_info_ptr; } else { - + /* No, threads suspended, restore interrupts. */ TX_RESTORE } diff --git a/common_smp/src/tx_event_flags_cleanup.c b/common_smp/src/tx_event_flags_cleanup.c index 3700b0fa..3f170976 100644 --- a/common_smp/src/tx_event_flags_cleanup.c +++ b/common_smp/src/tx_event_flags_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -30,47 +30,49 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes event flags timeout and thread terminate */ -/* actions that require the event flags data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes event flags timeout and thread terminate */ +/* actions that require the event flags data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_event_flags_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,7 +82,7 @@ VOID _tx_event_flags_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_EVENT_FLAGS_GROUP *group_ptr; +TX_EVENT_FLAGS_GROUP *group_ptr; UINT suspended_count; TX_THREAD *suspension_head; TX_THREAD *next_thread; @@ -102,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) { @@ -131,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) { @@ -142,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; @@ -151,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; } @@ -159,35 +161,35 @@ 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; } - } + } } 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; } - + /* 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_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 @@ -214,15 +216,15 @@ 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); /* Disable interrupts. */ TX_DISABLE #endif - } + } #ifndef TX_NOT_INTERRUPTABLE } } diff --git a/common_smp/src/tx_event_flags_create.c b/common_smp/src/tx_event_flags_create.c index cc06e755..807894f5 100644 --- a/common_smp/src/tx_event_flags_create.c +++ b/common_smp/src/tx_event_flags_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,43 +31,45 @@ /**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_create PORTABLE C */ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a group of 32 event flags. All the flags are */ -/* initially in a cleared state. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to event flags group */ -/* control block */ -/* name_ptr Pointer to event flags name */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a group of 32 event flags. All the flags are */ +/* initially in a cleared state. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to event flags group */ +/* control block */ +/* name_ptr Pointer to event flags name */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr) @@ -84,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 @@ -114,12 +116,12 @@ TX_EVENT_FLAGS_GROUP *previous_group; /* Setup this group's created links. */ group_ptr -> tx_event_flags_group_created_previous = previous_group; - group_ptr -> tx_event_flags_group_created_next = next_group; + group_ptr -> tx_event_flags_group_created_next = next_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_smp/src/tx_event_flags_delete.c b/common_smp/src/tx_event_flags_delete.c index c0368223..f384f126 100644 --- a/common_smp/src/tx_event_flags_delete.c +++ b/common_smp/src/tx_event_flags_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,45 +31,47 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified event flag group. All threads */ -/* suspended on the group are resumed with the TX_DELETED status */ -/* code. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified event flag group. All threads */ +/* suspended on the group are resumed with the TX_DELETED status */ +/* code. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr) @@ -77,7 +79,7 @@ UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; UINT suspended_count; TX_EVENT_FLAGS_GROUP *next_group; @@ -104,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) { @@ -124,9 +126,9 @@ 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; + _tx_event_flags_created_ptr = next_group; } } @@ -134,7 +136,7 @@ TX_EVENT_FLAGS_GROUP *previous_group; _tx_thread_preempt_disable++; /* Pickup the suspension information. */ - thread_ptr = group_ptr -> tx_event_flags_group_suspension_list; + thread_ptr = group_ptr -> tx_event_flags_group_suspension_list; group_ptr -> tx_event_flags_group_suspension_list = TX_NULL; suspended_count = group_ptr -> tx_event_flags_group_suspended_count; group_ptr -> tx_event_flags_group_suspended_count = TX_NO_SUSPENSIONS; @@ -142,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_smp/src/tx_event_flags_get.c b/common_smp/src/tx_event_flags_get.c index c991fc08..1e79a4cd 100644 --- a/common_smp/src/tx_event_flags_get.c +++ b/common_smp/src/tx_event_flags_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,49 +31,51 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function gets the specified event flags from the group, */ -/* according to the get option. The get option also specifies whether */ -/* or not the retrieved flags are cleared. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* requested_event_flags Event flags requested */ -/* get_option Specifies and/or and clear options*/ -/* actual_flags_ptr Pointer to place the actual flags */ -/* the service retrieved */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread service */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function gets the specified event flags from the group, */ +/* according to the get option. The get option also specifies whether */ +/* or not the retrieved flags are cleared. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* requested_event_flags Event flags requested */ +/* get_option Specifies and/or and clear options*/ +/* actual_flags_ptr Pointer to place the actual flags */ +/* the service retrieved */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Suspend thread service */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, @@ -82,16 +84,16 @@ UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; UINT and_request; UINT clear_request; ULONG current_flags; -ULONG flags_satisfied; +ULONG flags_satisfied; #ifndef TX_NOT_INTERRUPTABLE ULONG delayed_clear_flags; #endif UINT suspended_count; -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; TX_THREAD *previous_thread; #ifndef TX_NOT_INTERRUPTABLE @@ -128,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); } @@ -148,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)) { @@ -162,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); @@ -188,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); } @@ -209,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)) { @@ -233,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) { @@ -250,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 @@ -277,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; } @@ -294,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) @@ -323,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) { @@ -348,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; @@ -375,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 @@ -386,7 +388,7 @@ UINT interrupted_set_request; } else { - + /* Immediate return, return error completion. */ status = TX_NO_EVENTS; } diff --git a/common_smp/src/tx_event_flags_info_get.c b/common_smp/src/tx_event_flags_info_get.c index a474ea2e..feec2a9c 100644 --- a/common_smp/src/tx_event_flags_info_get.c +++ b/common_smp/src/tx_event_flags_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -30,55 +30,57 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified event flag */ -/* group. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to event flag group */ -/* name Destination for the event flag */ -/* group name */ -/* current_flags Current event flags */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on event flags */ -/* suspended_count Destination for suspended count */ -/* next_group Destination for pointer to next */ -/* event flag group on the created */ -/* list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified event flag */ +/* group. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to event flag group */ +/* name Destination for the event flag */ +/* group name */ +/* current_flags Current event flags */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on event flags */ +/* suspended_count Destination for suspended count */ +/* next_group Destination for pointer to next */ +/* event flag group on the created */ +/* list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -100,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; } @@ -109,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_smp/src/tx_event_flags_initialize.c b/common_smp/src/tx_event_flags_initialize.c index 96f8ee00..867e684f 100644 --- a/common_smp/src/tx_event_flags_initialize.c +++ b/common_smp/src/tx_event_flags_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -68,42 +68,47 @@ ULONG _tx_event_flags_performance_timeout_count; -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the event flags component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the event flags component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_event_flags_initialize(VOID) diff --git a/common_smp/src/tx_event_flags_performance_info_get.c b/common_smp/src/tx_event_flags_performance_info_get.c index 2e15c9fc..a0cc23b0 100644 --- a/common_smp/src/tx_event_flags_performance_info_get.c +++ b/common_smp/src/tx_event_flags_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -32,51 +32,53 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* event flag group. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to event flag group */ -/* sets Destination for the number of */ -/* event flag sets on this group */ -/* gets Destination for the number of */ -/* event flag gets on this group */ -/* suspensions Destination for the number of */ -/* event flag suspensions on this */ -/* group */ -/* timeouts Destination for number of timeouts*/ -/* on this event flag group */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves performance information from the specified */ +/* event flag group. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to event flag group */ +/* sets Destination for the number of */ +/* event flag sets on this group */ +/* gets Destination for the number of */ +/* event flag gets on this group */ +/* suspensions Destination for the number of */ +/* event flag suspensions on this */ +/* group */ +/* timeouts Destination for number of timeouts*/ +/* on this event flag group */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets, @@ -92,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; } @@ -122,37 +124,37 @@ 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; - } + } #else UINT status; diff --git a/common_smp/src/tx_event_flags_performance_system_info_get.c b/common_smp/src/tx_event_flags_performance_system_info_get.c index d9803a4f..8fdbb317 100644 --- a/common_smp/src/tx_event_flags_performance_system_info_get.c +++ b/common_smp/src/tx_event_flags_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -32,48 +32,50 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves system event flag performance information. */ -/* */ -/* INPUT */ -/* */ -/* sets Destination for total number of */ -/* event flag sets */ -/* gets Destination for total number of */ -/* event flag gets */ -/* suspensions Destination for total number of */ -/* event flag suspensions */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves system event flag performance information. */ +/* */ +/* INPUT */ +/* */ +/* sets Destination for total number of */ +/* event flag sets */ +/* gets Destination for total number of */ +/* event flag gets */ +/* suspensions Destination for total number of */ +/* event flag suspensions */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts) @@ -99,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_smp/src/tx_event_flags_set.c b/common_smp/src/tx_event_flags_set.c index b1212810..9228f4cd 100644 --- a/common_smp/src/tx_event_flags_set.c +++ b/common_smp/src/tx_event_flags_set.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,48 +31,50 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_set PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_set PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function sets the specified flags in the event group based on */ -/* the set option specified. All threads suspended on the group whose */ -/* get request can now be satisfied are resumed. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* flags_to_set Event flags to set */ -/* set_option Specified either AND or OR */ -/* operation on the event flags */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function sets the specified flags in the event group based on */ +/* the set option specified. All threads suspended on the group whose */ +/* get request can now be satisfied are resumed. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* flags_to_set Event flags to set */ +/* set_option Specified either AND or OR */ +/* operation on the event flags */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option) @@ -80,20 +82,20 @@ UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, U TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *next_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *next_thread_ptr; TX_THREAD *next_thread; TX_THREAD *previous_thread; -TX_THREAD *satisfied_list; -TX_THREAD *last_satisfied; -TX_THREAD *suspended_list; -UINT suspended_count; -ULONG current_event_flags; +TX_THREAD *satisfied_list; +TX_THREAD *last_satisfied; +TX_THREAD *suspended_list; +UINT suspended_count; +ULONG current_event_flags; ULONG requested_flags; ULONG flags_satisfied; ULONG *suspend_info_ptr; UINT and_request; -UINT get_option; +UINT get_option; UINT clear_request; UINT preempt_check; #ifndef TX_NOT_INTERRUPTABLE @@ -135,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) { @@ -152,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; @@ -168,10 +170,10 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ #ifndef TX_NOT_INTERRUPTABLE } -#endif +#endif /* Restore interrupts. */ - TX_RESTORE + TX_RESTORE } else { @@ -193,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 @@ -208,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)) { @@ -221,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; @@ -234,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); } @@ -254,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)) { @@ -288,7 +290,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -313,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. */ @@ -323,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; @@ -335,7 +337,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ _tx_thread_preempt_disable++; /* Loop to examine all of the suspended threads. */ - do + do { #ifndef TX_NOT_INTERRUPTABLE @@ -357,7 +359,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_ /* Move the thread pointer to the beginning of the search list. */ thread_ptr = suspended_list; - /* Reset the suspended count. */ + /* Reset the suspended count. */ suspended_count = group_ptr -> tx_event_flags_group_suspended_count; /* Update the current events with any new ones that might @@ -380,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); } @@ -400,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); } @@ -419,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) @@ -435,18 +437,18 @@ 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. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; } /* We need to remove the thread from the suspension list and place it in the @@ -476,12 +478,12 @@ 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; } - } - + } + /* Decrement the suspension count. */ group_ptr -> tx_event_flags_group_suspended_count--; @@ -492,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; } @@ -500,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; @@ -513,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. */ @@ -541,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; @@ -584,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_smp/src/tx_event_flags_set_notify.c b/common_smp/src/tx_event_flags_set_notify.c index 47e8e598..1dc1cb49 100644 --- a/common_smp/src/tx_event_flags_set_notify.c +++ b/common_smp/src/tx_event_flags_set_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -30,44 +30,46 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_event_flags_set_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_event_flags_set_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers an application callback function that is */ -/* called whenever an event flag is set in this group. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block*/ -/* group_put_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function registers an application callback function that is */ +/* called whenever an event flag is set in this group. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block*/ +/* group_put_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)) diff --git a/common_smp/src/tx_initialize_high_level.c b/common_smp/src/tx_initialize_high_level.c index 2e4d6262..c7914fc6 100644 --- a/common_smp/src/tx_initialize_high_level.c +++ b/common_smp/src/tx_initialize_high_level.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Initialize */ /** */ @@ -44,68 +44,70 @@ #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; -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_initialize_high_level PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_initialize_high_level PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is responsible for initializing all of the other */ +/* */ +/* This function is responsible for initializing all of the other */ /* components in the ThreadX real-time kernel. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_initialize Initialize the thread control */ -/* component */ -/* _tx_timer_initialize Initialize the timer control */ -/* component */ -/* _tx_semaphore_initialize Initialize the semaphore control */ -/* component */ -/* _tx_queue_initialize Initialize the queue control */ -/* component */ -/* _tx_event_flags_initialize Initialize the event flags control*/ -/* component */ -/* _tx_block_pool_initialize Initialize the block pool control */ -/* component */ -/* _tx_byte_pool_initialize Initialize the byte pool control */ -/* component */ -/* _tx_mutex_initialize Initialize the mutex control */ -/* component */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_kernel_enter Kernel entry function */ -/* _tx_initialize_kernel_setup Early kernel setup function that */ -/* is optionally called by */ -/* compiler's startup code. */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_initialize Initialize the thread control */ +/* component */ +/* _tx_timer_initialize Initialize the timer control */ +/* component */ +/* _tx_semaphore_initialize Initialize the semaphore control */ +/* component */ +/* _tx_queue_initialize Initialize the queue control */ +/* component */ +/* _tx_event_flags_initialize Initialize the event flags control*/ +/* component */ +/* _tx_block_pool_initialize Initialize the block pool control */ +/* component */ +/* _tx_byte_pool_initialize Initialize the byte pool control */ +/* component */ +/* _tx_mutex_initialize Initialize the mutex control */ +/* component */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_kernel_enter Kernel entry function */ +/* _tx_initialize_kernel_setup Early kernel setup function that */ +/* is optionally called by */ +/* compiler's startup code. */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_initialize_high_level(VOID) diff --git a/common_smp/src/tx_initialize_kernel_enter.c b/common_smp/src/tx_initialize_kernel_enter.c index 9b31a0d5..4f57da02 100644 --- a/common_smp/src/tx_initialize_kernel_enter.c +++ b/common_smp/src/tx_initialize_kernel_enter.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Initialize */ /** */ @@ -42,49 +42,49 @@ TX_SAFETY_CRITICAL_EXCEPTION_HANDLER #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_initialize_kernel_enter PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_initialize_kernel_enter PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is the first ThreadX function called during */ -/* initialization. It is called from the application's "main()" */ -/* function. It is important to note that this routine never */ -/* returns. The processing of this function is relatively simple: */ -/* it calls several ThreadX initialization functions (if needed), */ -/* calls the application define function, and then invokes the */ -/* scheduler. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_high_level_initialize SMP initialization */ -/* _tx_thread_smp_current_state_set Set system state for all cores */ -/* _tx_initialize_low_level Low-level initialization */ -/* _tx_initialize_high_level High-level initialization */ -/* tx_application_define Application define function */ -/* _tx_thread_scheduler ThreadX scheduling loop */ -/* */ -/* CALLED BY */ -/* */ -/* main Application main program */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function is the first ThreadX function called during */ +/* initialization. It is called from the application's "main()" */ +/* function. It is important to note that this routine never */ +/* returns. The processing of this function is relatively simple: */ +/* it calls several ThreadX initialization functions (if needed), */ +/* calls the application define function, and then invokes the */ +/* scheduler. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_high_level_initialize SMP initialization */ +/* _tx_thread_smp_current_state_set Set system state for all cores */ +/* _tx_initialize_low_level Low-level initialization */ +/* _tx_initialize_high_level High-level initialization */ +/* tx_application_define Application define function */ +/* _tx_thread_scheduler ThreadX scheduling loop */ +/* */ +/* CALLED BY */ +/* */ +/* main Application main program */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -102,8 +102,8 @@ ULONG other_core_status, i; /* 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_smp_current_state_set(TX_INITIALIZE_IN_PROGRESS); @@ -116,9 +116,9 @@ ULONG other_core_status, i; /* Call the high-level SMP Initialization. */ _tx_thread_smp_high_level_initialize(); - - /* 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(); @@ -129,8 +129,8 @@ ULONG other_core_status, i; /* 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[0] = TX_INITIALIZE_IN_PROGRESS; @@ -147,7 +147,7 @@ ULONG other_core_status, i; /* Release the other cores from initialization. */ _tx_thread_smp_release_cores_flag = TX_TRUE; - + /* Add all the status together... Other cores must clear their system state before they they are released. */ other_core_status = ((ULONG) 0); @@ -158,7 +158,7 @@ ULONG other_core_status, i; for (i = ((ULONG) 1); i < _tx_thread_smp_max_cores; i++) #endif { - + /* Call port-specific memory synchronization primitive. */ TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION @@ -166,10 +166,10 @@ ULONG other_core_status, i; /* Add the states of each subsequent core. */ other_core_status = other_core_status + _tx_thread_system_state[i]; } - + } while (other_core_status != ((ULONG) 0)); - - /* 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[0] = TX_INITIALIZE_IS_FINISHED; diff --git a/common_smp/src/tx_initialize_kernel_setup.c b/common_smp/src/tx_initialize_kernel_setup.c index 73474a3b..67c2a0c4 100644 --- a/common_smp/src/tx_initialize_kernel_setup.c +++ b/common_smp/src/tx_initialize_kernel_setup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Initialize */ /** */ @@ -31,44 +31,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_initialize_kernel_setup PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_initialize_kernel_setup PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is called by the compiler's startup code to make */ -/* ThreadX objects accessible to the compiler's library. If this */ -/* function is not called by the compiler, all ThreadX initialization */ -/* takes place from the kernel enter function defined previously. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_high_level_initialize SMP initialization */ -/* _tx_thread_smp_current_state_set Set system state for all cores */ -/* _tx_initialize_low_level Low-level initialization */ -/* _tx_initialize_high_level High-level initialization */ -/* */ -/* CALLED BY */ -/* */ -/* startup code Compiler startup code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function is called by the compiler's startup code to make */ +/* ThreadX objects accessible to the compiler's library. If this */ +/* function is not called by the compiler, all ThreadX initialization */ +/* takes place from the kernel enter function defined previously. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_high_level_initialize SMP initialization */ +/* _tx_thread_smp_current_state_set Set system state for all cores */ +/* _tx_initialize_low_level Low-level initialization */ +/* _tx_initialize_high_level High-level initialization */ +/* */ +/* CALLED BY */ +/* */ +/* startup code Compiler startup code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -77,8 +77,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_smp_current_state_set(TX_INITIALIZE_IN_PROGRESS); @@ -88,12 +88,12 @@ VOID _tx_initialize_kernel_setup(VOID) /* Invoke the low-level initialization to handle all processor specific initialization issues. */ _tx_initialize_low_level(); - + /* Call the high-level SMP Initialization. */ _tx_thread_smp_high_level_initialize(); - /* 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_smp/src/tx_misra.c b/common_smp/src/tx_misra.c index ae2280ef..c48b88bb 100644 --- a/common_smp/src/tx_misra.c +++ b/common_smp/src/tx_misra.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** ThreadX MISRA Compliance */ /** */ @@ -23,8 +23,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** _tx_version_id */ +/** */ +/** _tx_version_id */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -40,8 +40,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size); */ +/** */ +/** VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -53,8 +53,8 @@ VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size) /**************************************************************************/ /**************************************************************************/ -/** */ -/** UCHAR *_tx_misra_uchar_pointer_add(UCHAR *ptr, ULONG amount); */ +/** */ +/** UCHAR *_tx_misra_uchar_pointer_add(UCHAR *ptr, ULONG amount); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -67,8 +67,8 @@ UCHAR *_tx_misra_uchar_pointer_add(UCHAR *ptr, ULONG amount) /**************************************************************************/ /**************************************************************************/ -/** */ -/** UCHAR *_tx_misra_uchar_pointer_sub(UCHAR *ptr, ULONG amount); */ +/** */ +/** UCHAR *_tx_misra_uchar_pointer_sub(UCHAR *ptr, ULONG amount); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -81,8 +81,8 @@ UCHAR *_tx_misra_uchar_pointer_sub(UCHAR *ptr, ULONG amount) /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2); */ +/** */ +/** ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -90,7 +90,7 @@ ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2) { ULONG value; - + value = ptr1 - ptr2; return(value); } @@ -98,8 +98,8 @@ ULONG value; /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG _tx_misra_pointer_to_ulong_convert(VOID *ptr); */ +/** */ +/** ULONG _tx_misra_pointer_to_ulong_convert(VOID *ptr); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -111,8 +111,8 @@ ULONG _tx_misra_pointer_to_ulong_convert(VOID *ptr) /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG *_tx_misra_ulong_pointer_add(ULONG *ptr, ULONG amount); */ +/** */ +/** ULONG *_tx_misra_ulong_pointer_add(ULONG *ptr, ULONG amount); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -125,8 +125,8 @@ ULONG *_tx_misra_ulong_pointer_add(ULONG *ptr, ULONG amount) /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount); */ +/** */ +/** ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -140,15 +140,15 @@ ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount) /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2); */ +/** */ +/** ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2); */ /** */ /**************************************************************************/ /**************************************************************************/ ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2) { ULONG value; - + value = ptr1 - ptr2; return(value); } @@ -156,8 +156,8 @@ ULONG value; /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID *_tx_misra_ulong_to_pointer_convert(ULONG input); */ +/** */ +/** VOID *_tx_misra_ulong_to_pointer_convert(ULONG input); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -170,9 +170,9 @@ VOID *_tx_misra_ulong_to_pointer_convert(ULONG input) /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID _tx_misra_message_copy(ULONG **source, ULONG **destination, */ -/** UINT size); */ +/** */ +/** VOID _tx_misra_message_copy(ULONG **source, ULONG **destination, */ +/** UINT size); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -186,9 +186,9 @@ UINT z; d = *destination; z = size; - *(d) = *(s); + *(d) = *(s); (d)++; - (s)++; + (s)++; if ((z) > ((UINT) 1)) { (z)--; @@ -208,9 +208,9 @@ UINT z; /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, */ -/** TX_TIMER_INTERNAL **ptr2); */ +/** */ +/** ULONG _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, */ +/** TX_TIMER_INTERNAL **ptr2); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -226,9 +226,9 @@ ULONG value; /**************************************************************************/ /**************************************************************************/ -/** */ -/** TX_TIMER_INTERNAL **_tx_misra_timer_pointer_add(TX_TIMER_INTERNAL */ -/** **ptr1, ULONG size); */ +/** */ +/** TX_TIMER_INTERNAL **_tx_misra_timer_pointer_add(TX_TIMER_INTERNAL */ +/** **ptr1, ULONG size); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -241,16 +241,16 @@ TX_TIMER_INTERNAL **_tx_misra_timer_pointer_add(TX_TIMER_INTERNAL **ptr1, ULONG /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL */ -/** *internal_timer, TX_TIMER **user_timer); */ +/** */ +/** VOID _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL */ +/** *internal_timer, TX_TIMER **user_timer); */ /** */ /**************************************************************************/ /**************************************************************************/ VOID _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL *internal_timer, TX_TIMER **user_timer) { -UCHAR *working_ptr; +UCHAR *working_ptr; TX_TIMER *temp_timer; @@ -264,40 +264,40 @@ TX_TIMER *temp_timer; /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, */ -/** VOID **highest_stack); */ +/** */ +/** VOID _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, */ +/** VOID **highest_stack); */ /** */ /**************************************************************************/ /**************************************************************************/ VOID _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, VOID **highest_stack) { -TX_INTERRUPT_SAVE_AREA +TX_INTERRUPT_SAVE_AREA - TX_DISABLE - if (((thread_ptr)) && ((thread_ptr) -> tx_thread_id == TX_THREAD_ID)) - { - if (((ULONG *) (thread_ptr) -> tx_thread_stack_ptr) < ((ULONG *) *highest_stack)) - { - *highest_stack = (thread_ptr) -> tx_thread_stack_ptr; - } - if ((*((ULONG *) (thread_ptr) -> tx_thread_stack_start) != TX_STACK_FILL) || - (*((ULONG *) (((UCHAR *) (thread_ptr) -> tx_thread_stack_end) + 1)) != TX_STACK_FILL) || - (((ULONG *) *highest_stack) < ((ULONG *) (thread_ptr) -> tx_thread_stack_start))) - { - TX_RESTORE - _tx_thread_stack_error_handler((thread_ptr)); - TX_DISABLE - } - if (*(((ULONG *) *highest_stack) - 1) != TX_STACK_FILL) - { - TX_RESTORE - _tx_thread_stack_analyze((thread_ptr)); - TX_DISABLE - } - } - TX_RESTORE + TX_DISABLE + if (((thread_ptr)) && ((thread_ptr) -> tx_thread_id == TX_THREAD_ID)) + { + if (((ULONG *) (thread_ptr) -> tx_thread_stack_ptr) < ((ULONG *) *highest_stack)) + { + *highest_stack = (thread_ptr) -> tx_thread_stack_ptr; + } + if ((*((ULONG *) (thread_ptr) -> tx_thread_stack_start) != TX_STACK_FILL) || + (*((ULONG *) (((UCHAR *) (thread_ptr) -> tx_thread_stack_end) + 1)) != TX_STACK_FILL) || + (((ULONG *) *highest_stack) < ((ULONG *) (thread_ptr) -> tx_thread_stack_start))) + { + TX_RESTORE + _tx_thread_stack_error_handler((thread_ptr)); + TX_DISABLE + } + if (*(((ULONG *) *highest_stack) - 1) != TX_STACK_FILL) + { + TX_RESTORE + _tx_thread_stack_analyze((thread_ptr)); + TX_DISABLE + } + } + TX_RESTORE } @@ -305,70 +305,70 @@ TX_INTERRUPT_SAVE_AREA /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID _tx_misra_trace_event_insert(ULONG event_id, */ -/** VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, */ -/** ULONG info_field_4, ULONG filter, ULONG time_stamp); */ +/** */ +/** VOID _tx_misra_trace_event_insert(ULONG event_id, */ +/** VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, */ +/** ULONG info_field_4, ULONG filter, ULONG time_stamp); */ /** */ /**************************************************************************/ /**************************************************************************/ VOID _tx_misra_trace_event_insert(ULONG event_id, VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, ULONG time_stamp) { -TX_TRACE_BUFFER_ENTRY *trace_event_ptr; -ULONG trace_system_state; -ULONG trace_priority; -TX_THREAD *trace_thread_ptr; +TX_TRACE_BUFFER_ENTRY *trace_event_ptr; +ULONG trace_system_state; +ULONG trace_priority; +TX_THREAD *trace_thread_ptr; trace_event_ptr = _tx_trace_buffer_current_ptr; if ((trace_event_ptr) && (_tx_trace_event_enable_bits & ((ULONG) (filter)))) { - TX_TRACE_PORT_EXTENSION - trace_system_state = (ULONG) _tx_thread_system_state; - trace_thread_ptr = _tx_thread_current_ptr; + TX_TRACE_PORT_EXTENSION + trace_system_state = (ULONG) _tx_thread_system_state; + trace_thread_ptr = _tx_thread_current_ptr; - if (trace_system_state == 0) - { - trace_priority = trace_thread_ptr -> tx_thread_priority; + if (trace_system_state == 0) + { + trace_priority = trace_thread_ptr -> tx_thread_priority; trace_priority = trace_priority | 0x80000000UL | (trace_thread_ptr -> tx_thread_preempt_threshold << 16); - } + } else if (trace_system_state < 0xF0F0F0F0UL) - { - trace_priority = (ULONG) trace_thread_ptr; - trace_thread_ptr = (TX_THREAD *) 0xFFFFFFFFUL; - } - else - { - trace_thread_ptr = (TX_THREAD *) 0xF0F0F0F0UL; - trace_priority = 0; + { + trace_priority = (ULONG) trace_thread_ptr; + trace_thread_ptr = (TX_THREAD *) 0xFFFFFFFFUL; } - trace_event_ptr -> tx_trace_buffer_entry_thread_pointer = (ULONG) trace_thread_ptr; - trace_event_ptr -> tx_trace_buffer_entry_thread_priority = (ULONG) trace_priority; - trace_event_ptr -> tx_trace_buffer_entry_event_id = (ULONG) (event_id); - trace_event_ptr -> tx_trace_buffer_entry_time_stamp = (ULONG) (time_stamp); + else + { + trace_thread_ptr = (TX_THREAD *) 0xF0F0F0F0UL; + trace_priority = 0; + } + trace_event_ptr -> tx_trace_buffer_entry_thread_pointer = (ULONG) trace_thread_ptr; + trace_event_ptr -> tx_trace_buffer_entry_thread_priority = (ULONG) trace_priority; + trace_event_ptr -> tx_trace_buffer_entry_event_id = (ULONG) (event_id); + trace_event_ptr -> tx_trace_buffer_entry_time_stamp = (ULONG) (time_stamp); #ifdef TX_MISRA_ENABLE - trace_event_ptr -> tx_trace_buffer_entry_info_1 = (ULONG) (info_field_1); - trace_event_ptr -> tx_trace_buffer_entry_info_2 = (ULONG) (info_field_2); - trace_event_ptr -> tx_trace_buffer_entry_info_3 = (ULONG) (info_field_3); - trace_event_ptr -> tx_trace_buffer_entry_info_4 = (ULONG) (info_field_4); + trace_event_ptr -> tx_trace_buffer_entry_info_1 = (ULONG) (info_field_1); + trace_event_ptr -> tx_trace_buffer_entry_info_2 = (ULONG) (info_field_2); + trace_event_ptr -> tx_trace_buffer_entry_info_3 = (ULONG) (info_field_3); + trace_event_ptr -> tx_trace_buffer_entry_info_4 = (ULONG) (info_field_4); #else - trace_event_ptr -> tx_trace_buffer_entry_information_field_1 = (ULONG) (info_field_1); - trace_event_ptr -> tx_trace_buffer_entry_information_field_2 = (ULONG) (info_field_2); - trace_event_ptr -> tx_trace_buffer_entry_information_field_3 = (ULONG) (info_field_3); - trace_event_ptr -> tx_trace_buffer_entry_information_field_4 = (ULONG) (info_field_4); + trace_event_ptr -> tx_trace_buffer_entry_information_field_1 = (ULONG) (info_field_1); + trace_event_ptr -> tx_trace_buffer_entry_information_field_2 = (ULONG) (info_field_2); + trace_event_ptr -> tx_trace_buffer_entry_information_field_3 = (ULONG) (info_field_3); + trace_event_ptr -> tx_trace_buffer_entry_information_field_4 = (ULONG) (info_field_4); #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; - if (_tx_trace_full_notify_function) - (_tx_trace_full_notify_function)((VOID *) _tx_trace_header_ptr); + 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; + if (_tx_trace_full_notify_function) + (_tx_trace_full_notify_function)((VOID *) _tx_trace_header_ptr); } - else - { + else + { _tx_trace_buffer_current_ptr = trace_event_ptr; _tx_trace_header_ptr -> tx_trace_header_buffer_current_pointer = (ULONG) trace_event_ptr; } @@ -377,8 +377,8 @@ TX_THREAD *trace_thread_ptr; /**************************************************************************/ /**************************************************************************/ -/** */ -/** ULONG _tx_misra_time_stamp_get(VOID); */ +/** */ +/** ULONG _tx_misra_time_stamp_get(VOID); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -387,15 +387,15 @@ ULONG _tx_misra_time_stamp_get(VOID) /* Return time stamp. */ return(0); -} +} #endif /**************************************************************************/ /**************************************************************************/ -/** */ -/** UINT _tx_misra_always_true(void); */ +/** */ +/** UINT _tx_misra_always_true(void); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -407,8 +407,8 @@ UINT _tx_misra_always_true(void) /******************************************************************************************/ /******************************************************************************************/ -/** */ -/** UCHAR **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **return_ptr); */ +/** */ +/** UCHAR **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **return_ptr); */ /** */ /******************************************************************************************/ /******************************************************************************************/ @@ -422,8 +422,8 @@ UCHAR **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **return_ptr) /***************************************************************************************/ /***************************************************************************************/ -/** */ -/** UCHAR **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer); */ +/** */ +/** UCHAR **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer); */ /** */ /***************************************************************************************/ /***************************************************************************************/ @@ -437,8 +437,8 @@ UCHAR **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer) /***********************************************************************************/ /***********************************************************************************/ -/** */ -/** UCHAR *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool); */ +/** */ +/** UCHAR *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool); */ /** */ /***********************************************************************************/ /***********************************************************************************/ @@ -452,8 +452,8 @@ UCHAR *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool) /******************************************************************************************/ /******************************************************************************************/ -/** */ -/** TX_BLOCK_POOL *_tx_misra_void_to_block_pool_pointer_convert(VOID *pointer); */ +/** */ +/** TX_BLOCK_POOL *_tx_misra_void_to_block_pool_pointer_convert(VOID *pointer); */ /** */ /******************************************************************************************/ /******************************************************************************************/ @@ -467,8 +467,8 @@ TX_BLOCK_POOL *_tx_misra_void_to_block_pool_pointer_convert(VOID *pointer) /*****************************************************************************/ /*****************************************************************************/ -/** */ -/** UCHAR *_tx_misra_void_to_uchar_pointer_convert(VOID *pointer); */ +/** */ +/** UCHAR *_tx_misra_void_to_uchar_pointer_convert(VOID *pointer); */ /** */ /*****************************************************************************/ /*****************************************************************************/ @@ -482,8 +482,8 @@ UCHAR *_tx_misra_void_to_uchar_pointer_convert(VOID *pointer) /************************************************************************************/ /************************************************************************************/ -/** */ -/** TX_BLOCK_POOL *_tx_misra_uchar_to_block_pool_pointer_convert(UCHAR *pointer); */ +/** */ +/** TX_BLOCK_POOL *_tx_misra_uchar_to_block_pool_pointer_convert(UCHAR *pointer); */ /** */ /************************************************************************************/ /************************************************************************************/ @@ -497,8 +497,8 @@ TX_BLOCK_POOL *_tx_misra_uchar_to_block_pool_pointer_convert(UCHAR *pointer) /**************************************************************************************/ /**************************************************************************************/ -/** */ -/** UCHAR **_tx_misra_void_to_indirect_uchar_pointer_convert(VOID *pointer); */ +/** */ +/** UCHAR **_tx_misra_void_to_indirect_uchar_pointer_convert(VOID *pointer); */ /** */ /**************************************************************************************/ /**************************************************************************************/ @@ -512,8 +512,8 @@ UCHAR **_tx_misra_void_to_indirect_uchar_pointer_convert(VOID *pointer) /*****************************************************************************************/ /*****************************************************************************************/ -/** */ -/** TX_BYTE_POOL *_tx_misra_void_to_byte_pool_pointer_convert(VOID *pointer); */ +/** */ +/** TX_BYTE_POOL *_tx_misra_void_to_byte_pool_pointer_convert(VOID *pointer); */ /** */ /*****************************************************************************************/ /*****************************************************************************************/ @@ -527,8 +527,8 @@ TX_BYTE_POOL *_tx_misra_void_to_byte_pool_pointer_convert(VOID *pointer) /***************************************************************************************/ /***************************************************************************************/ -/** */ -/** UCHAR *_tx_misra_byte_pool_to_uchar_pointer_convert(TX_BYTE_POOL *pool); */ +/** */ +/** UCHAR *_tx_misra_byte_pool_to_uchar_pointer_convert(TX_BYTE_POOL *pool); */ /** */ /***************************************************************************************/ /***************************************************************************************/ @@ -542,8 +542,8 @@ UCHAR *_tx_misra_byte_pool_to_uchar_pointer_convert(TX_BYTE_POOL *pool) /*****************************************************************************************/ /*****************************************************************************************/ -/** */ -/** ALIGN_TYPE *_tx_misra_uchar_to_align_type_pointer_convert(UCHAR *pointer); */ +/** */ +/** ALIGN_TYPE *_tx_misra_uchar_to_align_type_pointer_convert(UCHAR *pointer); */ /** */ /*****************************************************************************************/ /*****************************************************************************************/ @@ -557,8 +557,8 @@ ALIGN_TYPE *_tx_misra_uchar_to_align_type_pointer_convert(UCHAR *pointer) /****************************************************************************************************/ /****************************************************************************************************/ -/** */ -/** TX_BYTE_POOL **_tx_misra_uchar_to_indirect_byte_pool_pointer_convert(UCHAR *pointer); */ +/** */ +/** TX_BYTE_POOL **_tx_misra_uchar_to_indirect_byte_pool_pointer_convert(UCHAR *pointer); */ /** */ /****************************************************************************************************/ /****************************************************************************************************/ @@ -572,8 +572,8 @@ TX_BYTE_POOL **_tx_misra_uchar_to_indirect_byte_pool_pointer_convert(UCHAR *poi /**************************************************************************************************/ /**************************************************************************************************/ -/** */ -/** TX_EVENT_FLAGS_GROUP *_tx_misra_void_to_event_flags_pointer_convert(VOID *pointer); */ +/** */ +/** TX_EVENT_FLAGS_GROUP *_tx_misra_void_to_event_flags_pointer_convert(VOID *pointer); */ /** */ /**************************************************************************************************/ /**************************************************************************************************/ @@ -587,8 +587,8 @@ TX_EVENT_FLAGS_GROUP *_tx_misra_void_to_event_flags_pointer_convert(VOID *point /*****************************************************************************/ /*****************************************************************************/ -/** */ -/** ULONG *_tx_misra_void_to_ulong_pointer_convert(VOID *pointer); */ +/** */ +/** ULONG *_tx_misra_void_to_ulong_pointer_convert(VOID *pointer); */ /** */ /*****************************************************************************/ /*****************************************************************************/ @@ -602,8 +602,8 @@ ULONG *_tx_misra_void_to_ulong_pointer_convert(VOID *pointer) /********************************************************************************/ /********************************************************************************/ -/** */ -/** TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer); */ +/** */ +/** TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer); */ /** */ /********************************************************************************/ /********************************************************************************/ @@ -617,8 +617,8 @@ TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer) /**************************************************************************/ /**************************************************************************/ -/** */ -/** UINT _tx_misra_status_get(UINT status); */ +/** */ +/** UINT _tx_misra_status_get(UINT status); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -632,8 +632,8 @@ UINT _tx_misra_status_get(UINT status) /********************************************************************************/ /********************************************************************************/ -/** */ -/** TX_QUEUE *_tx_misra_void_to_queue_pointer_convert(VOID *pointer); */ +/** */ +/** TX_QUEUE *_tx_misra_void_to_queue_pointer_convert(VOID *pointer); */ /** */ /********************************************************************************/ /********************************************************************************/ @@ -647,8 +647,8 @@ TX_QUEUE *_tx_misra_void_to_queue_pointer_convert(VOID *pointer) /****************************************************************************************/ /****************************************************************************************/ -/** */ -/** TX_SEMAPHORE *_tx_misra_void_to_semaphore_pointer_convert(VOID *pointer); */ +/** */ +/** TX_SEMAPHORE *_tx_misra_void_to_semaphore_pointer_convert(VOID *pointer); */ /** */ /****************************************************************************************/ /****************************************************************************************/ @@ -662,8 +662,8 @@ TX_SEMAPHORE *_tx_misra_void_to_semaphore_pointer_convert(VOID *pointer) /**************************************************************************/ /**************************************************************************/ -/** */ -/** VOID *_tx_misra_uchar_to_void_pointer_convert(UCHAR *pointer); */ +/** */ +/** VOID *_tx_misra_uchar_to_void_pointer_convert(UCHAR *pointer); */ /** */ /**************************************************************************/ /**************************************************************************/ @@ -677,8 +677,8 @@ VOID *_tx_misra_uchar_to_void_pointer_convert(UCHAR *pointer) /*********************************************************************************/ /*********************************************************************************/ -/** */ -/** TX_THREAD *_tx_misra_ulong_to_thread_pointer_convert(ULONG value); */ +/** */ +/** TX_THREAD *_tx_misra_ulong_to_thread_pointer_convert(ULONG value); */ /** */ /*********************************************************************************/ /*********************************************************************************/ @@ -692,8 +692,8 @@ TX_THREAD *_tx_misra_ulong_to_thread_pointer_convert(ULONG value) /***************************************************************************************************/ /***************************************************************************************************/ -/** */ -/** VOID *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **pointer); */ +/** */ +/** VOID *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **pointer); */ /** */ /***************************************************************************************************/ /***************************************************************************************************/ @@ -707,8 +707,8 @@ VOID *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **poin /***************************************************************************************/ /***************************************************************************************/ -/** */ -/** CHAR *_tx_misra_const_char_to_char_pointer_convert(const char *pointer); */ +/** */ +/** CHAR *_tx_misra_const_char_to_char_pointer_convert(const char *pointer); */ /** */ /***************************************************************************************/ /***************************************************************************************/ @@ -722,8 +722,8 @@ CHAR *_tx_misra_const_char_to_char_pointer_convert(const char *pointer) /**********************************************************************************/ /**********************************************************************************/ -/** */ -/** TX_THREAD *_tx_misra_void_to_thread_pointer_convert(void *pointer); */ +/** */ +/** TX_THREAD *_tx_misra_void_to_thread_pointer_convert(void *pointer); */ /** */ /**********************************************************************************/ /**********************************************************************************/ @@ -739,8 +739,8 @@ TX_THREAD *_tx_misra_void_to_thread_pointer_convert(void *pointer) /************************************************************************************************/ /************************************************************************************************/ -/** */ -/** UCHAR *_tx_misra_object_to_uchar_pointer_convert(TX_TRACE_OBJECT_ENTRY *pointer); */ +/** */ +/** UCHAR *_tx_misra_object_to_uchar_pointer_convert(TX_TRACE_OBJECT_ENTRY *pointer); */ /** */ /************************************************************************************************/ /************************************************************************************************/ @@ -754,8 +754,8 @@ UCHAR *_tx_misra_object_to_uchar_pointer_convert(TX_TRACE_OBJECT_ENTRY *pointer /************************************************************************************************/ /************************************************************************************************/ -/** */ -/** TX_TRACE_OBJECT_ENTRY *_tx_misra_uchar_to_object_pointer_convert(UCHAR *pointer); */ +/** */ +/** TX_TRACE_OBJECT_ENTRY *_tx_misra_uchar_to_object_pointer_convert(UCHAR *pointer); */ /** */ /************************************************************************************************/ /************************************************************************************************/ @@ -769,8 +769,8 @@ TX_TRACE_OBJECT_ENTRY *_tx_misra_uchar_to_object_pointer_convert(UCHAR *pointer /******************************************************************************************/ /******************************************************************************************/ -/** */ -/** TX_TRACE_HEADER *_tx_misra_uchar_to_header_pointer_convert(UCHAR *pointer); */ +/** */ +/** TX_TRACE_HEADER *_tx_misra_uchar_to_header_pointer_convert(UCHAR *pointer); */ /** */ /******************************************************************************************/ /******************************************************************************************/ @@ -784,8 +784,8 @@ TX_TRACE_HEADER *_tx_misra_uchar_to_header_pointer_convert(UCHAR *pointer) /***********************************************************************************************/ /***********************************************************************************************/ -/** */ -/** TX_TRACE_BUFFER_ENTRY *_tx_misra_uchar_to_entry_pointer_convert(UCHAR *pointer); */ +/** */ +/** TX_TRACE_BUFFER_ENTRY *_tx_misra_uchar_to_entry_pointer_convert(UCHAR *pointer); */ /** */ /***********************************************************************************************/ /***********************************************************************************************/ @@ -799,8 +799,8 @@ TX_TRACE_BUFFER_ENTRY *_tx_misra_uchar_to_entry_pointer_convert(UCHAR *pointer) /***********************************************************************************************/ /***********************************************************************************************/ -/** */ -/** UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer); */ +/** */ +/** UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer); */ /** */ /***********************************************************************************************/ /***********************************************************************************************/ @@ -810,14 +810,14 @@ UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer) /* Return a UCHAR pointer. */ return((UCHAR *) ((VOID *) pointer)); } - + #endif /***********************************************************************************************/ /***********************************************************************************************/ -/** */ -/** UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer); */ +/** */ +/** UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer); */ /** */ /***********************************************************************************************/ /***********************************************************************************************/ diff --git a/common_smp/src/tx_mutex_cleanup.c b/common_smp/src/tx_mutex_cleanup.c index 09ca5904..ec62600e 100644 --- a/common_smp/src/tx_mutex_cleanup.c +++ b/common_smp/src/tx_mutex_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -30,47 +30,49 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes mutex timeout and thread terminate */ -/* actions that require the mutex data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes mutex timeout and thread terminate */ +/* actions that require the mutex data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_mutex_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,7 +82,7 @@ VOID _tx_mutex_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_MUTEX *mutex_ptr; +TX_MUTEX *mutex_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -98,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) { @@ -131,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) { @@ -145,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; @@ -155,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 @@ -192,7 +194,7 @@ TX_THREAD *previous_thread; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread! */ _tx_thread_system_resume(thread_ptr); @@ -206,50 +208,52 @@ TX_THREAD *previous_thread; } } } - + /* Restore interrupts. */ TX_RESTORE #endif } -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_thread_release PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_thread_release PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function releases all mutexes owned by the thread. This */ -/* function is called when the thread completes or is terminated. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread's control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_put Release the mutex */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_shell_entry Thread completion processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function releases all mutexes owned by the thread. This */ +/* function is called when the thread completes or is terminated. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread's control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_put Release the mutex */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_shell_entry Thread completion processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_mutex_thread_release(TX_THREAD *thread_ptr) @@ -265,24 +269,24 @@ 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); - + /* Restore interrupts. */ TX_RESTORE @@ -301,12 +305,12 @@ UINT status; /* Move to the next mutex. */ 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_smp/src/tx_mutex_create.c b/common_smp/src/tx_mutex_create.c index 4b459f33..a811df87 100644 --- a/common_smp/src/tx_mutex_create.c +++ b/common_smp/src/tx_mutex_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,44 +31,46 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a mutex with optional priority inheritance as */ -/* specified in this call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block*/ -/* name_ptr Pointer to mutex name */ -/* inherit Priority inheritance option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a mutex with optional priority inheritance as */ +/* specified in this call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block*/ +/* name_ptr Pointer to mutex name */ +/* inherit Priority inheritance option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit) @@ -86,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 @@ -119,12 +121,12 @@ TX_MUTEX *previous_mutex; /* Setup this mutex's next and previous created links. */ mutex_ptr -> tx_mutex_created_previous = previous_mutex; - mutex_ptr -> tx_mutex_created_next = next_mutex; + mutex_ptr -> tx_mutex_created_next = next_mutex; } /* Increment the ownership count. */ _tx_mutex_created_count++; - + /* Optional mutex create extended processing. */ TX_MUTEX_CREATE_EXTENSION(mutex_ptr) diff --git a/common_smp/src/tx_mutex_delete.c b/common_smp/src/tx_mutex_delete.c index c7ea53c9..76a4441f 100644 --- a/common_smp/src/tx_mutex_delete.c +++ b/common_smp/src/tx_mutex_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,46 +31,48 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified mutex. All threads */ -/* suspended on the mutex are resumed with the TX_DELETED status */ -/* code. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_put Release an owned mutex */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified mutex. All threads */ +/* suspended on the mutex are resumed with the TX_DELETED status */ +/* code. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_put Release an owned mutex */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr) @@ -78,7 +80,7 @@ UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; TX_THREAD *owner_thread; UINT suspended_count; @@ -108,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) { @@ -128,9 +130,9 @@ 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; + _tx_mutex_created_ptr = next_mutex; } } @@ -138,7 +140,7 @@ UINT status; _tx_thread_preempt_disable++; /* Pickup the suspension information. */ - thread_ptr = mutex_ptr -> tx_mutex_suspension_list; + thread_ptr = mutex_ptr -> tx_mutex_suspension_list; mutex_ptr -> tx_mutex_suspension_list = TX_NULL; suspended_count = mutex_ptr -> tx_mutex_suspended_count; mutex_ptr -> tx_mutex_suspended_count = TX_NO_SUSPENSIONS; @@ -154,10 +156,10 @@ UINT status; { /* Yes, remove this mutex from the owned list. */ - + /* Set the ownership count to 1. */ mutex_ptr -> tx_mutex_ownership_count = ((UINT) 1); - + /* Restore interrupts. */ TX_RESTORE @@ -172,7 +174,7 @@ UINT status; #endif /* Disable interrupts. */ - TX_DISABLE + TX_DISABLE } /* Restore interrupts. */ @@ -182,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; @@ -213,7 +215,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread. */ _tx_thread_system_resume(thread_ptr); #endif diff --git a/common_smp/src/tx_mutex_get.c b/common_smp/src/tx_mutex_get.c index 14f91d4e..d5c9a077 100644 --- a/common_smp/src/tx_mutex_get.c +++ b/common_smp/src/tx_mutex_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,45 +31,47 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function gets the specified mutex. If the calling thread */ -/* already owns the mutex, an ownership count is simply increased. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread service */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* _tx_mutex_priority_change Inherit thread priority */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function gets the specified mutex. If the calling thread */ +/* already owns the mutex, an ownership count is simply increased. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Suspend thread service */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* _tx_mutex_priority_change Inherit thread priority */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option) @@ -77,7 +79,7 @@ UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_MUTEX *next_mutex; TX_MUTEX *previous_mutex; TX_THREAD *mutex_owner; @@ -124,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; @@ -176,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++; @@ -198,7 +200,7 @@ UINT status; { /* Restore interrupts. */ - TX_RESTORE + TX_RESTORE /* Suspension is not allowed if the preempt disable flag is non-zero at this point - return error completion. */ status = TX_NOT_AVAILABLE; @@ -277,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++; @@ -286,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) { @@ -302,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; } @@ -345,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) { @@ -361,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; } @@ -396,7 +398,7 @@ UINT status; { /* Restore interrupts. */ - TX_RESTORE + TX_RESTORE /* Immediate return, return error completion. */ status = TX_NOT_AVAILABLE; diff --git a/common_smp/src/tx_mutex_info_get.c b/common_smp/src/tx_mutex_info_get.c index 5774798e..b28f9479 100644 --- a/common_smp/src/tx_mutex_info_get.c +++ b/common_smp/src/tx_mutex_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -30,54 +30,56 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified mutex. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* name Destination for the mutex name */ -/* count Destination for the owner count */ -/* owner Destination for the owner's */ -/* thread control block pointer */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on the mutex */ -/* suspended_count Destination for suspended count */ -/* next_mutex Destination for pointer to next */ -/* mutex on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified mutex. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* name Destination for the mutex name */ +/* count Destination for the owner count */ +/* owner Destination for the owner's */ +/* thread control block pointer */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on the mutex */ +/* suspended_count Destination for suspended count */ +/* next_mutex Destination for pointer to next */ +/* mutex on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ 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) { @@ -99,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_smp/src/tx_mutex_initialize.c b/common_smp/src/tx_mutex_initialize.c index 39057e28..941912b3 100644 --- a/common_smp/src/tx_mutex_initialize.c +++ b/common_smp/src/tx_mutex_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -77,42 +77,47 @@ ULONG _tx_mutex_performance__priority_inheritance_count; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the mutex component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the mutex component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_mutex_initialize(VOID) diff --git a/common_smp/src/tx_mutex_performance_info_get.c b/common_smp/src/tx_mutex_performance_info_get.c index 496be285..7bd0512e 100644 --- a/common_smp/src/tx_mutex_performance_info_get.c +++ b/common_smp/src/tx_mutex_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,54 +31,56 @@ #include "tx_trace.h" #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* mutex. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ +/* */ +/* This function retrieves performance information from the specified */ +/* mutex. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ /* puts Destination for the number of */ -/* puts on to this mutex */ -/* gets Destination for the number of */ -/* gets on this mutex */ -/* suspensions Destination for the number of */ -/* suspensions on this mutex */ -/* timeouts Destination for number of timeouts*/ -/* on this mutex */ -/* inversions Destination for number of priority*/ -/* inversions on this mutex */ -/* inheritances Destination for number of priority*/ -/* inheritances on this mutex */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* puts on to this mutex */ +/* gets Destination for the number of */ +/* gets on this mutex */ +/* suspensions Destination for the number of */ +/* suspensions on this mutex */ +/* timeouts Destination for number of timeouts*/ +/* on this mutex */ +/* inversions Destination for number of priority*/ +/* inversions on this mutex */ +/* inheritances Destination for number of priority*/ +/* inheritances on this mutex */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets, @@ -97,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; } @@ -127,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 } @@ -223,7 +225,7 @@ UINT status; status = TX_FEATURE_NOT_ENABLED; } #endif - + /* Return completion status. */ return(status); } diff --git a/common_smp/src/tx_mutex_performance_system_info_get.c b/common_smp/src/tx_mutex_performance_system_info_get.c index 9c4155f4..04409e7b 100644 --- a/common_smp/src/tx_mutex_performance_system_info_get.c +++ b/common_smp/src/tx_mutex_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -32,55 +32,57 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves system mutex performance information. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function retrieves system mutex performance information. */ +/* */ +/* INPUT */ +/* */ /* puts Destination for total number of */ -/* mutex puts */ -/* gets Destination for total number of */ -/* mutex gets */ -/* suspensions Destination for total number of */ -/* mutex suspensions */ -/* timeouts Destination for total number of */ -/* mutex timeouts */ -/* inversions Destination for total number of */ -/* mutex priority inversions */ -/* inheritances Destination for total number of */ -/* mutex priority inheritances */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* mutex puts */ +/* gets Destination for total number of */ +/* mutex gets */ +/* suspensions Destination for total number of */ +/* mutex suspensions */ +/* timeouts Destination for total number of */ +/* mutex timeouts */ +/* inversions Destination for total number of */ +/* mutex priority inversions */ +/* inheritances Destination for total number of */ +/* mutex priority inheritances */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -104,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; @@ -157,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_smp/src/tx_mutex_prioritize.c b/common_smp/src/tx_mutex_prioritize.c index dd38d1b4..3aae0e18 100644 --- a/common_smp/src/tx_mutex_prioritize.c +++ b/common_smp/src/tx_mutex_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,43 +31,45 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the highest priority suspended thread at the */ -/* front of the suspension list. All other threads remain in the same */ -/* FIFO suspension order. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the highest priority suspended thread at the */ +/* front of the suspension list. All other threads remain in the same */ +/* FIFO suspension order. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_prioritize(TX_MUTEX *mutex_ptr) @@ -75,8 +77,8 @@ UINT _tx_mutex_prioritize(TX_MUTEX *mutex_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *priority_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *priority_thread_ptr; TX_THREAD *head_ptr; UINT suspended_count; TX_THREAD *next_thread; @@ -126,7 +128,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE } - else + else { /* Remember the suspension count and head pointer. */ @@ -162,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) { @@ -213,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_smp/src/tx_mutex_priority_change.c b/common_smp/src/tx_mutex_priority_change.c index 5a5587af..794fbed7 100644 --- a/common_smp/src/tx_mutex_priority_change.c +++ b/common_smp/src/tx_mutex_priority_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,49 +31,49 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_priority_change PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_priority_change PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function changes the priority of the specified thread for the */ -/* priority inheritance option of the mutex service. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* new_priority New thread priority */ -/* new_threshold New preemption-threshold */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list */ -/* Rebalance the execution list */ -/* _tx_thread_smp_simple_priority_change */ -/* Change priority */ -/* _tx_thread_system_resume Resume thread */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_thread_system_suspend Suspend thread */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_mutex_get Inherit priority */ -/* _tx_mutex_put Restore previous priority */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function changes the priority of the specified thread for the */ +/* priority inheritance option of the mutex service. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* new_priority New thread priority */ +/* new_threshold New preemption-threshold */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list */ +/* Rebalance the execution list */ +/* _tx_thread_smp_simple_priority_change */ +/* Change priority */ +/* _tx_thread_system_resume Resume thread */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_thread_system_suspend Suspend thread */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_mutex_get Inherit priority */ +/* _tx_mutex_put Restore previous priority */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -115,7 +115,7 @@ UINT finished; /* Determine if there is anything to do. */ if (thread_ptr -> tx_thread_priority == new_priority) { - + if (thread_ptr -> tx_thread_preempt_threshold == new_priority) { @@ -125,9 +125,9 @@ UINT finished; } /* Determine if there is still more to do. */ - if (finished == TX_FALSE) + if (finished == TX_FALSE) { - + /* Default the execute pointer to NULL. */ execute_ptr = TX_NULL; @@ -137,17 +137,17 @@ UINT finished; /* 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; } @@ -171,16 +171,16 @@ UINT finished; /* Remember this thread as the currently executing thread. */ execute_ptr = thread_ptr; - /* Determine if the thread is being set to a higher-priority and it does't have + /* Determine if the thread is being set to a higher-priority and it does't have preemption-threshold set. */ if (new_priority < thread_ptr -> tx_thread_priority) { - + /* Check for preemption-threshold. */ if (thread_ptr -> tx_thread_user_priority == thread_ptr -> tx_thread_user_preempt_threshold) { - /* Simple case, remove the thread from the current priority list and place in + /* Simple case, remove the thread from the current priority list and place in the higher priority list. */ _tx_thread_smp_simple_priority_change(thread_ptr, new_priority); @@ -194,20 +194,20 @@ UINT finished; /* Thread is not currently executing, so it can just be moved to the lower priority in the list. */ - /* Determine if the thread is being set to a lower-priority and it does't have + /* Determine if the thread is being set to a lower-priority and it does't have preemption-threshold set. */ - if (new_priority > thread_ptr -> tx_thread_priority) + if (new_priority > thread_ptr -> tx_thread_priority) { - + /* Check for preemption-threshold. */ if (thread_ptr -> tx_thread_user_priority == thread_ptr -> tx_thread_user_preempt_threshold) { - /* Simple case, remove the thread from the current priority list and place in + /* Simple case, remove the thread from the current priority list and place in the lower priority list. */ if (new_priority < thread_ptr -> tx_thread_user_priority) { - + /* Use the new priority. */ _tx_thread_smp_simple_priority_change(thread_ptr, new_priority); } @@ -219,11 +219,11 @@ UINT finished; } /* Set the finished flag to true. */ - finished = TX_TRUE; + finished = TX_TRUE; } } } - + /* Now determine if we are finished. */ if (finished == TX_FALSE) { @@ -242,33 +242,33 @@ UINT finished; /* 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. */ /* Determine how to setup the thread's priority. */ if (thread_ptr -> tx_thread_user_priority < new_priority) { - + /* Change thread priority to the user's priority. */ thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_user_priority; } else { - + /* 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; } @@ -293,42 +293,42 @@ UINT finished; thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = ((UINT) 0); /* Restore interrupts. */ - TX_RESTORE + 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); /* Lockout interrupts again. */ 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. */ /* Determine how to setup the thread's priority. */ if (thread_ptr -> tx_thread_user_priority < new_priority) { - + /* Change thread priority to the user's priority. */ thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_user_priority; } else { - + /* 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; } @@ -348,7 +348,7 @@ UINT finished; /* Disable interrupts. */ TX_DISABLE #endif - + /* Determine if the thread was previously executing. */ if (thread_ptr == execute_ptr) { @@ -390,7 +390,7 @@ UINT finished; /* Determine if this thread is not the next thread to execute. */ if (thread_ptr != _tx_thread_execute_ptr[core_index]) { - + /* Now determine if this thread was previously executing thread. */ if (thread_ptr == execute_ptr) { @@ -406,32 +406,32 @@ UINT finished; /* Determine the lowest priority scheduled thread. */ lowest_priority = _tx_thread_smp_lowest_priority_get(); - /* Determine if this thread has a higher or same priority as the lowest priority + /* Determine if this thread has a higher or same priority as the lowest priority in the list. */ if (thread_ptr -> tx_thread_priority <= lowest_priority) { /* Yes, we need to rebalance to make it possible for this thread to execute. */ - /* Determine if the thread with preemption-threshold thread has changed... and is + /* Determine if the thread with preemption-threshold thread has changed... and is not the scheduled thread. */ if ((original_pt_thread != _tx_thread_preemption__threshold_scheduled) && (original_pt_thread != thread_ptr)) { - + /* Yes, preemption-threshold has changed. Determine if it can or should be reversed. */ - + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* Pickup the preemption-threshold thread. */ new_pt_thread = _tx_thread_preemption__threshold_scheduled; #endif - + /* Restore the original preemption-threshold thread. */ _tx_thread_preemption__threshold_scheduled = original_pt_thread; - - + + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* Determine if there is a new preemption-threshold thread to reverse. */ @@ -465,7 +465,7 @@ UINT finished; } #endif } -#endif +#endif } /* Pickup the index. */ @@ -484,7 +484,7 @@ UINT finished; } #ifndef TX_NOT_INTERRUPTABLE - + /* Restore interrupts. */ TX_RESTORE #endif diff --git a/common_smp/src/tx_mutex_put.c b/common_smp/src/tx_mutex_put.c index 4f1aebd2..46b4c29f 100644 --- a/common_smp/src/tx_mutex_put.c +++ b/common_smp/src/tx_mutex_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,48 +31,50 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function puts back an instance of the specified mutex. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Success completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_mutex_priority_change Restore previous thread priority */ -/* _tx_mutex_prioritize Prioritize the mutex suspension */ -/* _tx_mutex_thread_release Release all thread's mutexes */ -/* _tx_mutex_delete Release ownership upon mutex */ -/* deletion */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function puts back an instance of the specified mutex. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Success completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_mutex_priority_change Restore previous thread priority */ +/* _tx_mutex_prioritize Prioritize the mutex suspension */ +/* _tx_mutex_thread_release Release all thread's mutexes */ +/* _tx_mutex_delete Release ownership upon mutex */ +/* deletion */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_mutex_put(TX_MUTEX *mutex_ptr) @@ -80,11 +82,11 @@ UINT _tx_mutex_put(TX_MUTEX *mutex_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *old_owner; -UINT old_priority; +TX_THREAD *thread_ptr; +TX_THREAD *old_owner; +UINT old_priority; UINT status; -TX_MUTEX *next_mutex; +TX_MUTEX *next_mutex; TX_MUTEX *previous_mutex; UINT owned_count; UINT suspended_count; @@ -129,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)) @@ -145,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--; @@ -164,7 +166,7 @@ UINT inheritance_priority; status = TX_SUCCESS; } else - { + { /* Check for a NULL thread pointer, which can only happen during initialization. */ if (thread_ptr == TX_NULL) @@ -180,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--; @@ -209,21 +211,21 @@ UINT inheritance_priority; { /* Yes, move the head pointer to the next link. */ - thread_ptr -> tx_thread_owned_mutex_list = next_mutex; + thread_ptr -> tx_thread_owned_mutex_list = next_mutex; } } - /* Determine if the simple, non-suspension, non-priority inheritance case is present. */ + /* 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 @@ -231,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; @@ -255,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) @@ -265,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) { @@ -282,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; } @@ -296,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; } @@ -330,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 @@ -360,7 +362,7 @@ UINT inheritance_priority; /* Now determine if there are any threads still waiting on the mutex. */ if (mutex_ptr -> tx_mutex_suspension_list == TX_NULL) - { + { /* No, there are no longer any threads waiting on the mutex. */ @@ -368,22 +370,22 @@ UINT inheritance_priority; /* Temporarily disable preemption. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ 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); } @@ -422,14 +424,14 @@ 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; /* Setup the highest priority waiting thread. */ mutex_ptr -> tx_mutex_highest_priority_waiting = (UINT) TX_MAX_PRIORITIES; } - + /* Determine how many mutexes are owned by this thread. */ owned_count = thread_ptr -> tx_thread_owned_mutex_count; @@ -471,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; @@ -480,7 +482,7 @@ UINT inheritance_priority; { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ mutex_ptr -> tx_mutex_suspension_list = TX_NULL; } @@ -497,15 +499,15 @@ UINT inheritance_priority; previous_thread = thread_ptr -> tx_thread_suspended_previous; 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. */ thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -534,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. */ @@ -549,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); } @@ -577,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) { @@ -592,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. */ @@ -616,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); } @@ -629,7 +631,7 @@ UINT inheritance_priority; /* Resume thread. */ _tx_thread_system_resume(thread_ptr); #endif - + /* Return a successful status. */ status = TX_SUCCESS; } @@ -643,9 +645,9 @@ UINT inheritance_priority; /* Restore interrupts. */ TX_RESTORE - + /* Caller does not own the mutex. */ - status = TX_NOT_OWNED; + status = TX_NOT_OWNED; } /* Return the completion status. */ diff --git a/common_smp/src/tx_queue_cleanup.c b/common_smp/src/tx_queue_cleanup.c index 0d289404..c6c9f935 100644 --- a/common_smp/src/tx_queue_cleanup.c +++ b/common_smp/src/tx_queue_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -30,47 +30,49 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes queue timeout and thread terminate */ -/* actions that require the queue data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes queue timeout and thread terminate */ +/* actions that require the queue data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_queue_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,12 +82,12 @@ VOID _tx_queue_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_QUEUE *queue_ptr; +TX_QUEUE *queue_ptr; 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. */ @@ -94,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) { @@ -120,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; @@ -159,14 +161,14 @@ TX_THREAD *previous_thread; /* Update the list head pointer. */ queue_ptr -> tx_queue_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_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 @@ -181,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_smp/src/tx_queue_create.c b/common_smp/src/tx_queue_create.c index 5f700843..01aec360 100644 --- a/common_smp/src/tx_queue_create.c +++ b/common_smp/src/tx_queue_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -30,56 +30,58 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a message queue. The message size and depth */ -/* of the queue is specified by the caller. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* name_ptr Pointer to queue name */ -/* message_size Size of each queue message */ -/* queue_start Starting address of the queue area*/ -/* queue_size Number of bytes in the queue */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a message queue. The message size and depth */ +/* of the queue is specified by the caller. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* name_ptr Pointer to queue name */ +/* message_size Size of each queue message */ +/* queue_start Starting address of the queue area*/ +/* queue_size Number of bytes in the queue */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { TX_INTERRUPT_SAVE_AREA -UINT capacity; -UINT used_words; +UINT capacity; +UINT used_words; TX_QUEUE *next_queue; TX_QUEUE *previous_queue; @@ -89,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; @@ -98,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); @@ -143,7 +145,7 @@ TX_QUEUE *previous_queue; /* Setup this queues's created links. */ queue_ptr -> tx_queue_created_previous = previous_queue; - queue_ptr -> tx_queue_created_next = next_queue; + queue_ptr -> tx_queue_created_next = next_queue; } /* Increment the created queue count. */ diff --git a/common_smp/src/tx_queue_delete.c b/common_smp/src/tx_queue_delete.c index a2755a50..c0fb13ce 100644 --- a/common_smp/src/tx_queue_delete.c +++ b/common_smp/src/tx_queue_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,44 +31,46 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified queue. All threads suspended */ -/* on the queue are resumed with the TX_DELETED status code. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified queue. All threads suspended */ +/* on the queue are resumed with the TX_DELETED status code. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_delete(TX_QUEUE *queue_ptr) @@ -76,7 +78,7 @@ UINT _tx_queue_delete(TX_QUEUE *queue_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; UINT suspended_count; TX_QUEUE *next_queue; @@ -123,9 +125,9 @@ 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; + _tx_queue_created_ptr = next_queue; } } @@ -133,7 +135,7 @@ TX_QUEUE *previous_queue; _tx_thread_preempt_disable++; /* Pickup the suspension information. */ - thread_ptr = queue_ptr -> tx_queue_suspension_list; + thread_ptr = queue_ptr -> tx_queue_suspension_list; queue_ptr -> tx_queue_suspension_list = TX_NULL; suspended_count = queue_ptr -> tx_queue_suspended_count; queue_ptr -> tx_queue_suspended_count = TX_NO_SUSPENSIONS; @@ -145,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_smp/src/tx_queue_flush.c b/common_smp/src/tx_queue_flush.c index 99bdb407..ac5c7e36 100644 --- a/common_smp/src/tx_queue_flush.c +++ b/common_smp/src/tx_queue_flush.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,45 +31,47 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_flush PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_flush PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function resets the specified queue, if there are any messages */ -/* in it. Messages waiting to be placed on the queue are also thrown */ -/* out. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function resets the specified queue, if there are any messages */ +/* in it. Messages waiting to be placed on the queue are also thrown */ +/* out. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_flush(TX_QUEUE *queue_ptr) @@ -77,9 +79,9 @@ UINT _tx_queue_flush(TX_QUEUE *queue_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *suspension_list; -UINT suspended_count; -TX_THREAD *thread_ptr; +TX_THREAD *suspension_list; +UINT suspended_count; +TX_THREAD *thread_ptr; /* Initialize the suspended count and list. */ @@ -111,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. */ @@ -139,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; @@ -180,11 +182,11 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Resume the thread. */ _tx_thread_system_resume(thread_ptr -> tx_thread_suspended_previous); #endif - } + } /* Disable interrupts. */ TX_DISABLE diff --git a/common_smp/src/tx_queue_front_send.c b/common_smp/src/tx_queue_front_send.c index 1f14bce6..51e7b935 100644 --- a/common_smp/src/tx_queue_front_send.c +++ b/common_smp/src/tx_queue_front_send.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,48 +31,50 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_front_send PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_front_send PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places a message at the front of the specified queue. */ -/* If there is no room in the queue, this function returns the */ -/* queue full status. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* source_ptr Pointer to message source */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread routine */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_thread_system_suspend Suspend thread routine */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places a message at the front of the specified queue. */ +/* If there is no room in the queue, this function returns the */ +/* queue full status. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* source_ptr Pointer to message source */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread routine */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_thread_system_suspend Suspend thread routine */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option) @@ -80,9 +82,9 @@ UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_opt TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -ULONG *source; -ULONG *destination; +TX_THREAD *thread_ptr; +ULONG *source; +ULONG *destination; UINT size; UINT suspended_count; TX_THREAD *next_thread; @@ -121,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) { @@ -135,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--; @@ -158,9 +160,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr); destination = queue_ptr -> tx_queue_read; - size = queue_ptr -> tx_queue_message_size; + 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) @@ -183,7 +185,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); (queue_send_notify)(queue_ptr); } #endif - } + } else { @@ -217,8 +219,8 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Decrement the suspension count. */ queue_ptr -> tx_queue_suspended_count = suspended_count; @@ -237,14 +239,14 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr); destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); - size = queue_ptr -> tx_queue_message_size; + 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) /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -264,7 +266,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Resume thread. */ _tx_thread_system_resume(thread_ptr); #endif - + #ifndef TX_DISABLE_NOTIFY_CALLBACKS /* Determine if a notify callback is required. */ @@ -298,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) @@ -343,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_smp/src/tx_queue_info_get.c b/common_smp/src/tx_queue_info_get.c index 0e388450..3275db72 100644 --- a/common_smp/src/tx_queue_info_get.c +++ b/common_smp/src/tx_queue_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -30,49 +30,51 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified queue. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* name Destination for the queue name */ -/* enqueued Destination for enqueued count */ -/* available_storage Destination for available storage */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on this queue */ -/* suspended_count Destination for suspended count */ -/* next_queue Destination for pointer to next */ -/* queue on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified queue. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* name Destination for the queue name */ +/* enqueued Destination for enqueued count */ +/* available_storage Destination for available storage */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on this queue */ +/* suspended_count Destination for suspended count */ +/* next_queue Destination for pointer to next */ +/* queue on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage, @@ -97,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_smp/src/tx_queue_initialize.c b/common_smp/src/tx_queue_initialize.c index 90b1b9bd..41fb6fa1 100644 --- a/common_smp/src/tx_queue_initialize.c +++ b/common_smp/src/tx_queue_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -75,42 +75,47 @@ ULONG _tx_queue_performance_timeout_count; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the queue component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the queue component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_queue_initialize(VOID) diff --git a/common_smp/src/tx_queue_performance_info_get.c b/common_smp/src/tx_queue_performance_info_get.c index 7d333efb..4bdb62e6 100644 --- a/common_smp/src/tx_queue_performance_info_get.c +++ b/common_smp/src/tx_queue_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -32,52 +32,54 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* queue. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* messages_sent Destination for messages sent */ -/* messages_received Destination for messages received */ -/* empty_suspensions Destination for number of empty */ -/* queue suspensions */ -/* full_suspensions Destination for number of full */ -/* queue suspensions */ -/* full_errors Destination for queue full errors */ -/* returned - no suspension */ -/* timeouts Destination for number of timeouts*/ -/* on this queue */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves performance information from the specified */ +/* queue. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* messages_sent Destination for messages sent */ +/* messages_received Destination for messages received */ +/* empty_suspensions Destination for number of empty */ +/* queue suspensions */ +/* full_suspensions Destination for number of full */ +/* queue suspensions */ +/* full_errors Destination for queue full errors */ +/* returned - no suspension */ +/* timeouts Destination for number of timeouts*/ +/* on this queue */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_performance_info_get(TX_QUEUE *queue_ptr, ULONG *messages_sent, ULONG *messages_received, @@ -93,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; } @@ -123,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_smp/src/tx_queue_performance_system_info_get.c b/common_smp/src/tx_queue_performance_system_info_get.c index 68b6f4b0..0299d068 100644 --- a/common_smp/src/tx_queue_performance_system_info_get.c +++ b/common_smp/src/tx_queue_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -32,52 +32,54 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves queue system performance information. */ -/* */ -/* INPUT */ -/* */ -/* messages_sent Destination for total messages */ -/* sent */ -/* messages_received Destination for total messages */ -/* received */ -/* empty_suspensions Destination for total empty */ -/* queue suspensions */ -/* full_suspensions Destination for total full */ -/* queue suspensions */ -/* full_errors Destination for total queue full */ -/* errors returned - no suspension */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves queue system performance information. */ +/* */ +/* INPUT */ +/* */ +/* messages_sent Destination for total messages */ +/* sent */ +/* messages_received Destination for total messages */ +/* received */ +/* empty_suspensions Destination for total empty */ +/* queue suspensions */ +/* full_suspensions Destination for total full */ +/* queue suspensions */ +/* full_errors Destination for total queue full */ +/* errors returned - no suspension */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received, @@ -104,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_smp/src/tx_queue_prioritize.c b/common_smp/src/tx_queue_prioritize.c index 54132aa4..ae80ce79 100644 --- a/common_smp/src/tx_queue_prioritize.c +++ b/common_smp/src/tx_queue_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,43 +31,45 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the highest priority suspended thread at the */ -/* front of the suspension list. All other threads remain in the same */ -/* FIFO suspension order. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the highest priority suspended thread at the */ +/* front of the suspension list. All other threads remain in the same */ +/* FIFO suspension order. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_prioritize(TX_QUEUE *queue_ptr) @@ -75,8 +77,8 @@ UINT _tx_queue_prioritize(TX_QUEUE *queue_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *priority_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *priority_thread_ptr; TX_THREAD *head_ptr; UINT suspended_count; TX_THREAD *next_thread; @@ -123,7 +125,7 @@ UINT list_changed; /* Restore interrupts. */ TX_RESTORE } - else + else { /* Remember the suspension count and head pointer. */ @@ -159,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) { @@ -210,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_smp/src/tx_queue_receive.c b/common_smp/src/tx_queue_receive.c index 5d4b2282..40568812 100644 --- a/common_smp/src/tx_queue_receive.c +++ b/common_smp/src/tx_queue_receive.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,50 +31,52 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_receive PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_receive PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function receives a message from the specified queue. If there */ -/* are no messages in the queue, this function waits according to the */ -/* option specified. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* destination_ptr Pointer to message destination */ -/* **** MUST BE LARGE ENOUGH TO */ -/* HOLD MESSAGE **** */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread routine */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_thread_system_suspend Suspend thread routine */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function receives a message from the specified queue. If there */ +/* are no messages in the queue, this function waits according to the */ +/* option specified. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* destination_ptr Pointer to message destination */ +/* **** MUST BE LARGE ENOUGH TO */ +/* HOLD MESSAGE **** */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread routine */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_thread_system_suspend Suspend thread routine */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option) @@ -82,9 +84,9 @@ UINT _tx_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_o TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -ULONG *source; -ULONG *destination; +TX_THREAD *thread_ptr; +ULONG *source; +ULONG *destination; UINT size; UINT suspended_count; TX_THREAD *next_thread; @@ -116,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) { @@ -126,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; + 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) @@ -143,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++; @@ -158,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. */ @@ -177,13 +179,13 @@ UINT status; /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr); - size = queue_ptr -> tx_queue_message_size; + 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) @@ -207,8 +209,8 @@ UINT status; previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Decrement the suspension count. */ queue_ptr -> tx_queue_suspended_count = suspended_count; @@ -218,7 +220,7 @@ UINT status; thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -242,16 +244,16 @@ 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. */ /* 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; + 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) @@ -265,7 +267,7 @@ UINT status; /* Setup the queue read pointer. */ queue_ptr -> tx_queue_read = source; - + /* Disable preemption. */ _tx_thread_preempt_disable++; @@ -287,16 +289,16 @@ UINT status; /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); destination = queue_ptr -> tx_queue_write; - size = queue_ptr -> tx_queue_message_size; + 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; } @@ -307,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) @@ -331,8 +333,8 @@ UINT status; previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Decrement the suspension count. */ queue_ptr -> tx_queue_suspended_count = suspended_count; @@ -342,7 +344,7 @@ UINT status; thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE @@ -376,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; } @@ -393,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) @@ -475,7 +477,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Immediate return, return error completion. */ status = TX_QUEUE_EMPTY; } diff --git a/common_smp/src/tx_queue_send.c b/common_smp/src/tx_queue_send.c index 8163350a..7cbb9b73 100644 --- a/common_smp/src/tx_queue_send.c +++ b/common_smp/src/tx_queue_send.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,57 +31,59 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_send PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_send PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places a message into the specified queue. If there */ -/* is no room in the queue, this function waits according to the */ -/* option specified. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* source_ptr Pointer to message source */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread routine */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_thread_system_suspend Suspend thread routine */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places a message into the specified queue. If there */ +/* is no room in the queue, this function waits according to the */ +/* option specified. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* source_ptr Pointer to message source */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread routine */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_thread_system_suspend Suspend thread routine */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option) { TX_INTERRUPT_SAVE_AREA - -TX_THREAD *thread_ptr; -ULONG *source; + +TX_THREAD *thread_ptr; +ULONG *source; ULONG *destination; UINT size; UINT suspended_count; @@ -126,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--; @@ -138,9 +140,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr); destination = queue_ptr -> tx_queue_write; - size = queue_ptr -> tx_queue_message_size; + 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) @@ -180,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. */ @@ -213,8 +215,8 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Decrement the suspension count. */ queue_ptr -> tx_queue_suspended_count = suspended_count; @@ -226,14 +228,14 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Setup source and destination pointers. */ source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr); destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info); - size = queue_ptr -> tx_queue_message_size; + 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) /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifndef TX_DISABLE_NOTIFY_CALLBACKS @@ -264,7 +266,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr); /* Determine if a notify callback is required. */ if (queue_send_notify != TX_NULL) - { + { /* Call application queue send notification. */ (queue_send_notify)(queue_ptr); @@ -272,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) { @@ -300,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_smp/src/tx_queue_send_notify.c b/common_smp/src/tx_queue_send_notify.c index 17784bcb..a0bbf527 100644 --- a/common_smp/src/tx_queue_send_notify.c +++ b/common_smp/src/tx_queue_send_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -30,44 +30,46 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_queue_send_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_queue_send_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers an application callback function that is */ -/* called whenever a messages is sent to this queue. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block*/ -/* queue_send_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function registers an application callback function that is */ +/* called whenever a messages is sent to this queue. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block*/ +/* queue_send_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)) diff --git a/common_smp/src/tx_semaphore_ceiling_put.c b/common_smp/src/tx_semaphore_ceiling_put.c index c79dd89c..30668683 100644 --- a/common_smp/src/tx_semaphore_ceiling_put.c +++ b/common_smp/src/tx_semaphore_ceiling_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,45 +31,47 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_ceiling_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_ceiling_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function puts an instance into the specified counting */ -/* semaphore up to the specified semaphore ceiling. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore */ -/* ceiling Maximum value of semaphore */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume */ -/* thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function puts an instance into the specified counting */ +/* semaphore up to the specified semaphore ceiling. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore */ +/* ceiling Maximum value of semaphore */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume */ +/* thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling) @@ -81,7 +83,7 @@ TX_INTERRUPT_SAVE_AREA VOID (*semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *notify_semaphore_ptr); #endif -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -187,8 +189,8 @@ UINT status; previous_thread = thread_ptr -> tx_thread_suspended_previous; next_thread -> tx_thread_suspended_previous = previous_thread; previous_thread -> tx_thread_suspended_next = next_thread; - } - + } + /* Decrement the suspension count. */ semaphore_ptr -> tx_semaphore_suspended_count = suspended_count; @@ -198,7 +200,7 @@ UINT status; thread_ptr -> tx_thread_suspend_cleanup = TX_NULL; /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifndef TX_DISABLE_NOTIFY_CALLBACKS diff --git a/common_smp/src/tx_semaphore_cleanup.c b/common_smp/src/tx_semaphore_cleanup.c index 7ba868b9..bb0f98f5 100644 --- a/common_smp/src/tx_semaphore_cleanup.c +++ b/common_smp/src/tx_semaphore_cleanup.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -30,47 +30,49 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_cleanup PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_cleanup PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes semaphore timeout and thread terminate */ -/* actions that require the semaphore data structures to be cleaned */ -/* up. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to suspended thread's */ -/* control block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_timeout Thread timeout processing */ -/* _tx_thread_terminate Thread terminate processing */ -/* _tx_thread_wait_abort Thread wait abort processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes semaphore timeout and thread terminate */ +/* actions that require the semaphore data structures to be cleaned */ +/* up. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to suspended thread's */ +/* control block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_timeout Thread timeout processing */ +/* _tx_thread_terminate Thread terminate processing */ +/* _tx_thread_wait_abort Thread wait abort processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_semaphore_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) @@ -80,12 +82,12 @@ VOID _tx_semaphore_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence) TX_INTERRUPT_SAVE_AREA #endif -TX_SEMAPHORE *semaphore_ptr; +TX_SEMAPHORE *semaphore_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; - + #ifndef TX_NOT_INTERRUPTABLE @@ -95,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) { @@ -119,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. */ @@ -138,7 +140,7 @@ TX_THREAD *previous_thread; { /* Yes, the only suspended thread. */ - + /* Update the head pointer. */ semaphore_ptr -> tx_semaphore_suspension_list = TX_NULL; } @@ -152,22 +154,22 @@ 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) { /* Update the list head pointer. */ semaphore_ptr -> tx_semaphore_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_SEMAPHORE_SUSP) { - /* Timeout condition and the thread is still suspended on the semaphore. + /* Timeout condition and the thread is still suspended on the semaphore. Setup return error status and resume the thread. */ #ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO @@ -194,7 +196,7 @@ TX_THREAD *previous_thread; /* Restore interrupts. */ TX_RESTORE - /* Resume the thread! */ + /* Resume the thread! */ _tx_thread_system_resume(thread_ptr); /* Disable interrupts. */ diff --git a/common_smp/src/tx_semaphore_create.c b/common_smp/src/tx_semaphore_create.c index 26db171b..31527d3a 100644 --- a/common_smp/src/tx_semaphore_create.c +++ b/common_smp/src/tx_semaphore_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -30,44 +30,46 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates a counting semaphore with the initial count */ -/* specified in this call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* name_ptr Pointer to semaphore name */ -/* initial_count Initial semaphore count */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates a counting semaphore with the initial count */ +/* specified in this call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* name_ptr Pointer to semaphore name */ +/* initial_count Initial semaphore count */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count) @@ -85,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 @@ -115,9 +117,9 @@ TX_SEMAPHORE *previous_semaphore; /* Setup this semaphore's next and previous created links. */ semaphore_ptr -> tx_semaphore_created_previous = previous_semaphore; - semaphore_ptr -> tx_semaphore_created_next = next_semaphore; + semaphore_ptr -> tx_semaphore_created_next = next_semaphore; } - + /* Increment the created count. */ _tx_semaphore_created_count++; diff --git a/common_smp/src/tx_semaphore_delete.c b/common_smp/src/tx_semaphore_delete.c index 20b5fe09..0a735474 100644 --- a/common_smp/src/tx_semaphore_delete.c +++ b/common_smp/src/tx_semaphore_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,45 +31,47 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified semaphore. All threads */ -/* suspended on the semaphore are resumed with the TX_DELETED status */ -/* code. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified semaphore. All threads */ +/* suspended on the semaphore are resumed with the TX_DELETED status */ +/* code. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr) @@ -77,7 +79,7 @@ UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; TX_THREAD *next_thread; UINT suspended_count; TX_SEMAPHORE *next_semaphore; @@ -124,9 +126,9 @@ 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; + _tx_semaphore_created_ptr = next_semaphore; } } @@ -137,7 +139,7 @@ TX_SEMAPHORE *previous_semaphore; thread_ptr = semaphore_ptr -> tx_semaphore_suspension_list; semaphore_ptr -> tx_semaphore_suspension_list = TX_NULL; suspended_count = semaphore_ptr -> tx_semaphore_suspended_count; - semaphore_ptr -> tx_semaphore_suspended_count = TX_NO_SUSPENSIONS; + semaphore_ptr -> tx_semaphore_suspended_count = TX_NO_SUSPENSIONS; /* Restore interrupts. */ TX_RESTORE @@ -146,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; @@ -177,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_smp/src/tx_semaphore_get.c b/common_smp/src/tx_semaphore_get.c index 36149566..7a0a6e13 100644 --- a/common_smp/src/tx_semaphore_get.c +++ b/common_smp/src/tx_semaphore_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,52 +31,54 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function gets an instance from the specified counting */ -/* semaphore. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Suspend thread service */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function gets an instance from the specified counting */ +/* semaphore. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Suspend thread service */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option) { TX_INTERRUPT_SAVE_AREA - -TX_THREAD *thread_ptr; + +TX_THREAD *thread_ptr; TX_THREAD *next_thread; TX_THREAD *previous_thread; UINT status; @@ -121,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 @@ -141,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_smp/src/tx_semaphore_info_get.c b/common_smp/src/tx_semaphore_info_get.c index 23d1fa35..e79ae662 100644 --- a/common_smp/src/tx_semaphore_info_get.c +++ b/common_smp/src/tx_semaphore_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -30,53 +30,55 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified semaphore. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* name Destination for the semaphore name*/ -/* current_value Destination for current value of */ -/* the semaphore */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on semaphore */ -/* suspended_count Destination for suspended count */ -/* next_semaphore Destination for pointer to next */ -/* semaphore on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified semaphore. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* name Destination for the semaphore name*/ +/* current_value Destination for current value of */ +/* the semaphore */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on semaphore */ +/* suspended_count Destination for suspended count */ +/* next_semaphore Destination for pointer to next */ +/* semaphore on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -98,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_smp/src/tx_semaphore_initialize.c b/common_smp/src/tx_semaphore_initialize.c index 338d9f1a..a304e54b 100644 --- a/common_smp/src/tx_semaphore_initialize.c +++ b/common_smp/src/tx_semaphore_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -67,42 +67,47 @@ ULONG _tx_semaphore_performance_timeout_count; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the semaphore component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the semaphore component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* opt out of function when */ +/* TX_INLINE_INITIALIZATION is */ +/* defined, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_semaphore_initialize(VOID) diff --git a/common_smp/src/tx_semaphore_performance_info_get.c b/common_smp/src/tx_semaphore_performance_info_get.c index 5dcac91e..29e2b5a3 100644 --- a/common_smp/src/tx_semaphore_performance_info_get.c +++ b/common_smp/src/tx_semaphore_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -32,50 +32,52 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* semaphore. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* This function retrieves performance information from the specified */ +/* semaphore. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ /* puts Destination for the number of */ -/* puts on to this semaphore */ -/* gets Destination for the number of */ -/* gets on this semaphore */ -/* suspensions Destination for the number of */ -/* suspensions on this semaphore */ -/* timeouts Destination for number of timeouts*/ -/* on this semaphore */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* puts on to this semaphore */ +/* gets Destination for the number of */ +/* gets on this semaphore */ +/* suspensions Destination for the number of */ +/* suspensions on this semaphore */ +/* timeouts Destination for number of timeouts*/ +/* on this semaphore */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets, @@ -91,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; } @@ -121,37 +123,37 @@ 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 /* Return successful completion. */ status = TX_SUCCESS; - } + } #else UINT status; @@ -159,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_smp/src/tx_semaphore_performance_system_info_get.c b/common_smp/src/tx_semaphore_performance_system_info_get.c index 22aef065..fb63710d 100644 --- a/common_smp/src/tx_semaphore_performance_system_info_get.c +++ b/common_smp/src/tx_semaphore_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -32,48 +32,50 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves system semaphore performance information. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function retrieves system semaphore performance information. */ +/* */ +/* INPUT */ +/* */ /* puts Destination for total number of */ -/* semaphore puts */ -/* gets Destination for total number of */ -/* semaphore gets */ -/* suspensions Destination for total number of */ -/* semaphore suspensions */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* semaphore puts */ +/* gets Destination for total number of */ +/* semaphore gets */ +/* suspensions Destination for total number of */ +/* semaphore suspensions */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts) @@ -99,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; @@ -137,32 +139,32 @@ 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_smp/src/tx_semaphore_prioritize.c b/common_smp/src/tx_semaphore_prioritize.c index c3bd686b..a7f8e40d 100644 --- a/common_smp/src/tx_semaphore_prioritize.c +++ b/common_smp/src/tx_semaphore_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,43 +31,45 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the highest priority suspended thread at the */ -/* front of the suspension list. All other threads remain in the same */ -/* FIFO suspension order. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the highest priority suspended thread at the */ +/* front of the suspension list. All other threads remain in the same */ +/* FIFO suspension order. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr) @@ -75,8 +77,8 @@ UINT _tx_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; -TX_THREAD *priority_thread_ptr; +TX_THREAD *thread_ptr; +TX_THREAD *priority_thread_ptr; TX_THREAD *head_ptr; UINT suspended_count; TX_THREAD *next_thread; @@ -123,7 +125,7 @@ UINT list_changed; /* Restore interrupts. */ TX_RESTORE } - else + else { /* Remember the suspension count and head pointer. */ @@ -159,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) { @@ -212,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_smp/src/tx_semaphore_put.c b/common_smp/src/tx_semaphore_put.c index 53748cf1..53db1a8b 100644 --- a/common_smp/src/tx_semaphore_put.c +++ b/common_smp/src/tx_semaphore_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,43 +31,45 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function puts an instance into the specified counting */ -/* semaphore. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Success completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Resume thread service */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function puts an instance into the specified counting */ +/* semaphore. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Success completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Resume thread service */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr) @@ -79,7 +81,7 @@ TX_INTERRUPT_SAVE_AREA VOID (*semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *notify_semaphore_ptr); #endif -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; UINT suspended_count; TX_THREAD *next_thread; TX_THREAD *previous_thread; @@ -137,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; @@ -166,8 +168,8 @@ 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; - } - + } + /* Decrement the suspension count. */ semaphore_ptr -> tx_semaphore_suspended_count = suspended_count; @@ -183,7 +185,7 @@ TX_THREAD *previous_thread; #endif /* Put return status into the thread control block. */ - thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; + thread_ptr -> tx_thread_suspend_status = TX_SUCCESS; #ifdef TX_NOT_INTERRUPTABLE diff --git a/common_smp/src/tx_semaphore_put_notify.c b/common_smp/src/tx_semaphore_put_notify.c index 9425b22e..5fb7c709 100644 --- a/common_smp/src/tx_semaphore_put_notify.c +++ b/common_smp/src/tx_semaphore_put_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -30,44 +30,46 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_put_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_put_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers an application callback function that is */ -/* called whenever the this semaphore is put. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore */ -/* semaphore_put_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function registers an application callback function that is */ +/* called whenever the this semaphore is put. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore */ +/* semaphore_put_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)) diff --git a/common_smp/src/tx_thread_create.c b/common_smp/src/tx_thread_create.c index d53a1815..a99af7e6 100644 --- a/common_smp/src/tx_thread_create.c +++ b/common_smp/src/tx_thread_create.c @@ -115,7 +115,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)); @@ -127,7 +127,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)); } @@ -166,7 +166,7 @@ ALIGN_TYPE updated_stack_start; /* Default thread creation such that core0 is the only allowed core for execution, i.e., bit 1 is set to exclude core1. */ thread_ptr -> tx_thread_smp_cores_excluded = (TX_THREAD_SMP_CORE_MASK & 0xFFFFFFFE); thread_ptr -> tx_thread_smp_cores_allowed = 1; - + /* Default the timers to run on core 0 as well. */ thread_ptr -> tx_thread_timer.tx_timer_internal_smp_cores_excluded = (TX_THREAD_SMP_CORE_MASK & 0xFFFFFFFE); @@ -214,7 +214,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); diff --git a/common_smp/src/tx_thread_delete.c b/common_smp/src/tx_thread_delete.c index f5519ab9..eaa3aa62 100644 --- a/common_smp/src/tx_thread_delete.c +++ b/common_smp/src/tx_thread_delete.c @@ -66,7 +66,9 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_delete(TX_THREAD *thread_ptr) @@ -81,7 +83,7 @@ UINT status; /* Default status to success. */ status = TX_SUCCESS; - + /* Lockout interrupts while the thread is being deleted. */ TX_DISABLE @@ -104,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. */ @@ -127,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) { @@ -147,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_smp/src/tx_thread_entry_exit_notify.c b/common_smp/src/tx_thread_entry_exit_notify.c index a32e5bdb..b8c69a61 100644 --- a/common_smp/src/tx_thread_entry_exit_notify.c +++ b/common_smp/src/tx_thread_entry_exit_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,46 +30,48 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_entry_exit_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_entry_exit_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers an application entry/exit notification */ -/* callback routine for the application. Once registered, the callback */ -/* routine is called when the thread is initially entered and called */ -/* again when the thread completes or is terminated. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* thread_entry_exit_notify Pointer to notify callback */ -/* function, TX_NULL to disable*/ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function registers an application entry/exit notification */ +/* callback routine for the application. Once registered, the callback */ +/* routine is called when the thread is initially entered and called */ +/* again when the thread completes or is terminated. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* thread_entry_exit_notify Pointer to notify callback */ +/* function, TX_NULL to disable*/ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT id)) diff --git a/common_smp/src/tx_thread_identify.c b/common_smp/src/tx_thread_identify.c index 04592a90..2b833b97 100644 --- a/common_smp/src/tx_thread_identify.c +++ b/common_smp/src/tx_thread_identify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -31,44 +31,46 @@ #include "tx_trace.h" #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_identify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_identify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns the control block pointer of the currently */ -/* executing thread. If the return value is NULL, no thread is */ -/* executing. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD * Pointer to control block of */ -/* currently executing thread */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function returns the control block pointer of the currently */ +/* executing thread. If the return value is NULL, no thread is */ +/* executing. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD * Pointer to control block of */ +/* currently executing thread */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ TX_THREAD *_tx_thread_identify(VOID) @@ -78,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_smp/src/tx_thread_info_get.c b/common_smp/src/tx_thread_info_get.c index b509445a..d12c0dcc 100644 --- a/common_smp/src/tx_thread_info_get.c +++ b/common_smp/src/tx_thread_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,56 +30,58 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified thread. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread control block */ -/* name Destination for the thread name */ -/* state Destination for thread state */ -/* run_count Destination for thread run count */ -/* priority Destination for thread priority */ -/* preemption_threshold Destination for thread preemption-*/ -/* threshold */ -/* time_slice Destination for thread time-slice */ -/* next_thread Destination for next created */ -/* thread */ -/* next_suspended_thread Destination for next suspended */ -/* thread */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified thread. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread control block */ +/* name Destination for the thread name */ +/* state Destination for thread state */ +/* run_count Destination for thread run count */ +/* priority Destination for thread priority */ +/* preemption_threshold Destination for thread preemption-*/ +/* threshold */ +/* time_slice Destination for thread time-slice */ +/* next_thread Destination for next created */ +/* thread */ +/* next_suspended_thread Destination for next suspended */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -101,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_smp/src/tx_thread_initialize.c b/common_smp/src/tx_thread_initialize.c index 2e3e521e..53759666 100644 --- a/common_smp/src/tx_thread_initialize.c +++ b/common_smp/src/tx_thread_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -50,7 +50,7 @@ TX_THREAD * _tx_thread_current_ptr[TX_THREAD_SMP_MAX_CORES]; /* 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. */ TX_THREAD * _tx_thread_execute_ptr[TX_THREAD_SMP_MAX_CORES]; @@ -95,7 +95,7 @@ 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. */ @@ -104,15 +104,15 @@ volatile ULONG _tx_thread_system_state[TX_THREAD_SMP_MAX_CORES]; /* 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 - or more threads at the associated thread priority are ready. */ + 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. */ 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 @@ -122,17 +122,17 @@ 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. */ 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 @@ -141,7 +141,7 @@ ULONG _tx_thread_preempted_map_active; /* Define the array that contains the thread at each priority level that was scheduled with - preemption-threshold enabled. This will be useful when returning from a nested + preemption-threshold enabled. This will be useful when returning from a nested preemption-threshold condition. */ TX_THREAD *_tx_thread_preemption_threshold_list[TX_MAX_PRIORITIES]; @@ -151,9 +151,9 @@ TX_THREAD *_tx_thread_preemption_threshold_list[TX_MAX_PRIORIT /* Define the last thread scheduled with preemption-threshold. When preemption-threshold is - disabled, a thread with preemption-threshold set disables all other threads from running. + disabled, a thread with preemption-threshold set disables all other threads from running. Effectively, its preemption-threshold is 0. */ - + TX_THREAD *_tx_thread_preemption__threshold_scheduled; @@ -166,13 +166,13 @@ 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. */ 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. */ VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_ptr); @@ -222,8 +222,8 @@ ULONG _tx_build_options; #ifdef TX_ENABLE_STACK_CHECKING -/* 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. */ VOID (*_tx_thread_application_stack_error_handler)(TX_THREAD *thread_ptr); @@ -238,20 +238,20 @@ VOID (*_tx_thread_application_stack_error_handler)(TX_THR 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. */ 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. */ 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. */ ULONG _tx_thread_performance_interrupt_preemption_count; @@ -263,39 +263,39 @@ ULONG _tx_thread_performance_interrupt_preemption_count; 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. */ 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. */ 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. */ 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. */ 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. */ 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. */ ULONG _tx_thread_performance_non_idle_return_count; @@ -306,44 +306,44 @@ ULONG _tx_thread_performance_non_idle_return_count; /* Define special string. */ #ifndef TX_MISRA_ENABLE -const CHAR _tx_thread_special_string[] = +const CHAR _tx_thread_special_string[] = "G-ML-EL-ML-BL-DL-BL-GB-GL-M-D-DL-GZ-KH-EL-CM-NH-HA-GF-DD-JC-YZ-CT-AT-DW-USA-CA-SD-SDSU"; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_initialize PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_initialize PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the thread control component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the thread control component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -352,7 +352,7 @@ const CHAR _tx_thread_special_string[] = VOID _tx_thread_initialize(VOID) { - /* Note: the system stack pointer and the system state variables are + /* Note: the system stack pointer and the system state variables are initialized by the low and high-level initialization functions, respectively. */ @@ -362,7 +362,7 @@ VOID _tx_thread_initialize(VOID) TX_THREAD_SET_CURRENT(0) /* Clear the execute thread list. */ - TX_MEMSET(&_tx_thread_execute_ptr[0], 0, (sizeof(_tx_thread_execute_ptr))); + TX_MEMSET(&_tx_thread_execute_ptr[0], 0, (sizeof(_tx_thread_execute_ptr))); /* Initialize the priority information. */ TX_MEMSET(&_tx_thread_priority_maps[0], 0, (sizeof(_tx_thread_priority_maps))); @@ -416,8 +416,8 @@ VOID _tx_thread_initialize(VOID) #endif /* Setup the build options flag. This is used to identify how the ThreadX library was constructed. */ - _tx_build_options = _tx_build_options - | (((ULONG) (TX_MAX_PRIORITIES/32)) << 24) + _tx_build_options = _tx_build_options + | (((ULONG) (TX_MAX_PRIORITIES/32)) << 24) #ifdef TX_NOT_INTERRUPTABLE | (((ULONG) 1) << 31) #endif @@ -469,14 +469,14 @@ VOID _tx_thread_initialize(VOID) #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO | (((ULONG) 1) << 9) #endif -#ifdef TX_ENABLE_EVENT_TRACE +#ifdef TX_ENABLE_EVENT_TRACE | (((ULONG) 1) << 8) #endif #ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY | (((ULONG) 1) << 7) #endif #if TX_PORT_SPECIFIC_BUILD_OPTIONS != 0 - | TX_PORT_SPECIFIC_BUILD_OPTIONS + | TX_PORT_SPECIFIC_BUILD_OPTIONS #endif ; } diff --git a/common_smp/src/tx_thread_performance_info_get.c b/common_smp/src/tx_thread_performance_info_get.c index d7a9c84a..737e1611 100644 --- a/common_smp/src/tx_thread_performance_info_get.c +++ b/common_smp/src/tx_thread_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,70 +32,72 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* thread. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread control block */ -/* resumptions Destination for number of times */ -/* thread was resumed */ -/* suspensions Destination for number of times */ -/* thread was suspended */ -/* solicited_preemptions Destination for number of times */ -/* thread called another service */ -/* that resulted in preemption */ -/* interrupt_preemptions Destination for number of times */ -/* thread was preempted by another */ -/* thread made ready in Interrupt */ -/* Service Routine (ISR) */ -/* priority_inversions Destination for number of times */ -/* a priority inversion was */ -/* detected for this thread */ -/* time_slices Destination for number of times */ -/* thread was time-sliced */ -/* relinquishes Destination for number of thread */ -/* relinquishes */ -/* timeouts Destination for number of timeouts*/ -/* for thread */ -/* wait_aborts Destination for number of wait */ -/* aborts for thread */ -/* last_preempted_by Destination for pointer of the */ -/* thread that last preempted this */ -/* thread */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves performance information from the specified */ +/* thread. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread control block */ +/* resumptions Destination for number of times */ +/* thread was resumed */ +/* suspensions Destination for number of times */ +/* thread was suspended */ +/* solicited_preemptions Destination for number of times */ +/* thread called another service */ +/* that resulted in preemption */ +/* interrupt_preemptions Destination for number of times */ +/* thread was preempted by another */ +/* thread made ready in Interrupt */ +/* Service Routine (ISR) */ +/* priority_inversions Destination for number of times */ +/* a priority inversion was */ +/* detected for this thread */ +/* time_slices Destination for number of times */ +/* thread was time-sliced */ +/* relinquishes Destination for number of thread */ +/* relinquishes */ +/* timeouts Destination for number of timeouts*/ +/* for thread */ +/* wait_aborts Destination for number of wait */ +/* aborts for thread */ +/* last_preempted_by Destination for pointer of the */ +/* thread that last preempted this */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -109,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; } @@ -139,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 @@ -217,7 +219,7 @@ UINT status; /* Access input arguments just for the sake of lint, MISRA, etc. */ - if (thread_ptr != TX_NULL) + if (thread_ptr != TX_NULL) { /* Not enabled, return error. */ diff --git a/common_smp/src/tx_thread_performance_system_info_get.c b/common_smp/src/tx_thread_performance_system_info_get.c index 3f8a5608..8c0afb43 100644 --- a/common_smp/src/tx_thread_performance_system_info_get.c +++ b/common_smp/src/tx_thread_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,67 +32,69 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves thread system performance information. */ -/* */ -/* INPUT */ -/* */ -/* resumptions Destination for total number of */ -/* thread resumptions */ -/* suspensions Destination for total number of */ -/* thread suspensions */ -/* solicited_preemptions Destination for total number of */ -/* thread preemption from thread */ -/* API calls */ -/* interrupt_preemptions Destination for total number of */ -/* thread preemptions as a result */ -/* of threads made ready inside of */ -/* Interrupt Service Routines */ -/* priority_inversions Destination for total number of */ -/* priority inversions */ -/* time_slices Destination for total number of */ -/* time-slices */ -/* relinquishes Destination for total number of */ -/* relinquishes */ -/* timeouts Destination for total number of */ -/* timeouts */ -/* wait_aborts Destination for total number of */ -/* wait aborts */ -/* non_idle_returns Destination for total number of */ -/* times threads return when */ -/* another thread is ready */ -/* idle_returns Destination for total number of */ -/* times threads return when no */ -/* other thread is ready */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves thread system performance information. */ +/* */ +/* INPUT */ +/* */ +/* resumptions Destination for total number of */ +/* thread resumptions */ +/* suspensions Destination for total number of */ +/* thread suspensions */ +/* solicited_preemptions Destination for total number of */ +/* thread preemption from thread */ +/* API calls */ +/* interrupt_preemptions Destination for total number of */ +/* thread preemptions as a result */ +/* of threads made ready inside of */ +/* Interrupt Service Routines */ +/* priority_inversions Destination for total number of */ +/* priority inversions */ +/* time_slices Destination for total number of */ +/* time-slices */ +/* relinquishes Destination for total number of */ +/* relinquishes */ +/* timeouts Destination for total number of */ +/* timeouts */ +/* wait_aborts Destination for total number of */ +/* wait aborts */ +/* non_idle_returns Destination for total number of */ +/* times threads return when */ +/* another thread is ready */ +/* idle_returns Destination for total number of */ +/* times threads return when no */ +/* other thread is ready */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions, @@ -121,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; @@ -209,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_smp/src/tx_thread_preemption_change.c b/common_smp/src/tx_thread_preemption_change.c index f0330b25..eca604d0 100644 --- a/common_smp/src/tx_thread_preemption_change.c +++ b/common_smp/src/tx_thread_preemption_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,44 +32,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_preemption_change PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_preemption_change PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes preemption-threshold change requests. The */ -/* previous preemption is returned to the caller. If the new request */ -/* allows a higher priority thread to execute, preemption takes place */ -/* inside of this function. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* new_threshold New preemption-threshold */ -/* old_threshold Old preemption-threshold */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes preemption-threshold change requests. The */ +/* previous preemption is returned to the caller. If the new request */ +/* allows a higher priority thread to execute, preemption takes place */ +/* inside of this function. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* new_threshold New preemption-threshold */ +/* old_threshold Old preemption-threshold */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -86,7 +86,7 @@ UINT core_index; ULONG priority_bit; UINT base_priority; UINT priority_bit_set; -ULONG priority_map; +ULONG priority_map; UINT next_preempted; TX_THREAD *preempted_thread; #if TX_MAX_PRIORITIES > 32 @@ -98,16 +98,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 (new_threshold < thread_ptr -> tx_thread_user_priority) { - + /* 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); @@ -130,10 +130,10 @@ UINT status; /* Determine if the new threshold is greater than the current user priority. */ if (new_threshold > thread_ptr -> tx_thread_user_priority) { - + /* Restore interrupts. */ TX_RESTORE - + /* Return error. */ status = TX_THRESH_ERROR; } @@ -149,13 +149,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; } @@ -163,7 +163,7 @@ UINT status; /* Determine if the thread is ready and scheduled. */ if (thread_ptr -> tx_thread_state == TX_READY) { - + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* Determine if the new threshold is the same as the priority. */ @@ -208,7 +208,7 @@ UINT status; /* Determine if this thread has global preemption disabled. */ if (thread_ptr == _tx_thread_preemption__threshold_scheduled) { - + /* Clear the global preemption disable flag. */ _tx_thread_preemption__threshold_scheduled = TX_NULL; @@ -219,7 +219,7 @@ UINT status; if (_tx_thread_preempted_map_active != ((ULONG) 0)) #else if (_tx_thread_preempted_maps[0] != ((ULONG) 0)) -#endif +#endif { #if TX_MAX_PRIORITIES > 32 @@ -247,11 +247,11 @@ UINT status; priority_bit = (ULONG) priority_bit_set; /* Setup the highest priority preempted thread. */ - next_preempted = base_priority + priority_bit; + next_preempted = base_priority + priority_bit; /* Pickup the previously preempted thread. */ preempted_thread = _tx_thread_preemption_threshold_list[next_preempted]; - + /* Pickup the preempted thread. */ _tx_thread_preemption__threshold_scheduled = preempted_thread; } @@ -265,7 +265,7 @@ UINT status; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(12, 0, thread_ptr); #endif - + /* Pickup the index. */ core_index = TX_SMP_CORE_ID; @@ -277,7 +277,7 @@ UINT status; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(13, 0, thread_ptr); #endif - + /* Restore interrupts. */ TX_RESTORE @@ -286,7 +286,7 @@ UINT status; } else { - + /* Restore interrupts. */ TX_RESTORE } diff --git a/common_smp/src/tx_thread_priority_change.c b/common_smp/src/tx_thread_priority_change.c index 69e907d0..6afda48d 100644 --- a/common_smp/src/tx_thread_priority_change.c +++ b/common_smp/src/tx_thread_priority_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -31,52 +31,52 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_priority_change PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_priority_change PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function changes the priority of the specified thread. It */ -/* also returns the old priority and handles preemption if the calling */ -/* thread is currently executing and the priority change results in a */ -/* higher priority thread ready for execution. */ -/* */ -/* Note: the preemption-threshold is automatically changed to the new */ +/* */ +/* This function changes the priority of the specified thread. It */ +/* also returns the old priority and handles preemption if the calling */ +/* thread is currently executing and the priority change results in a */ +/* higher priority thread ready for execution. */ +/* */ +/* Note: the preemption-threshold is automatically changed to the new */ /* priority. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* new_priority New thread priority */ -/* old_priority Old thread priority */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_smp_simple_priority_change Change priority */ -/* _tx_thread_system_resume Resume thread */ -/* _tx_thread_system_ni_resume Non-interruptable resume */ -/* _tx_thread_system_suspend Suspend thread */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* new_priority New thread priority */ +/* old_priority Old thread priority */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_smp_simple_priority_change Change priority */ +/* _tx_thread_system_resume Resume thread */ +/* _tx_thread_system_ni_resume Non-interruptable resume */ +/* _tx_thread_system_suspend Suspend thread */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -133,7 +133,7 @@ UINT status; } /* Determine if the inherit priority is in effect and there is no preemption-threshold in force. */ - else if ((thread_ptr -> tx_thread_inherit_priority < new_priority) && + else if ((thread_ptr -> tx_thread_inherit_priority < new_priority) && (thread_ptr -> tx_thread_user_preempt_threshold == thread_ptr -> tx_thread_user_priority)) { @@ -163,19 +163,19 @@ UINT status; 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; @@ -183,7 +183,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE - + /* Done, return success. */ status = TX_SUCCESS; } @@ -201,27 +201,27 @@ UINT status; { /* Yes, this thread is scheduled. */ - + /* Remember this thread as the currently executing thread. */ execute_ptr = thread_ptr; - /* Determine if the thread is being set to a higher-priority and it does't have + /* Determine if the thread is being set to a higher-priority and it does't have preemption-threshold set. */ if ((new_priority < thread_ptr -> tx_thread_priority) && (thread_ptr -> tx_thread_user_priority == thread_ptr -> tx_thread_user_preempt_threshold)) { - /* Simple case, remove the thread from the current priority list and place in + /* Simple case, remove the thread from the current priority list and place in the higher priority list. */ _tx_thread_smp_simple_priority_change(thread_ptr, new_priority); - + /* Setup the new priority for this thread. */ thread_ptr -> tx_thread_user_priority = new_priority; thread_ptr -> tx_thread_user_preempt_threshold = new_priority; /* Restore interrupts. */ TX_RESTORE - + /* Return a successful completion. */ status = TX_SUCCESS; } @@ -231,23 +231,23 @@ UINT status; /* Thread is not currently executing, so it can just be moved to the lower priority in the list. */ - /* Determine if the thread is being set to a lower-priority and it does't have + /* Determine if the thread is being set to a lower-priority and it does't have preemption-threshold set. */ if ((new_priority > thread_ptr -> tx_thread_priority) && (thread_ptr -> tx_thread_user_priority == thread_ptr -> tx_thread_user_preempt_threshold)) { - /* Simple case, remove the thread from the current priority list and place in + /* Simple case, remove the thread from the current priority list and place in the lower priority list. */ _tx_thread_smp_simple_priority_change(thread_ptr, new_priority); - + /* Setup the new priority for this thread. */ thread_ptr -> tx_thread_user_priority = new_priority; thread_ptr -> tx_thread_user_preempt_threshold = new_priority; /* Restore interrupts. */ TX_RESTORE - + /* Return a successful completion. */ status = TX_SUCCESS; } @@ -256,15 +256,15 @@ UINT status; /* Determine if we are done. */ if (status == TX_NOT_DONE) { - + /* Yes, more to do. */ - + /* Default the status to success. */ status = TX_SUCCESS; /* Save the original preemption-threshold thread. */ original_pt_thread = _tx_thread_preemption__threshold_scheduled; - + #ifdef TX_NOT_INTERRUPTABLE /* Increment the preempt disable flag. */ @@ -276,7 +276,7 @@ UINT status; /* 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. */ @@ -287,14 +287,14 @@ UINT status; 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; @@ -320,16 +320,16 @@ UINT status; thread_ptr -> tx_thread_timer.tx_timer_internal_remaining_ticks = ((ULONG) 0); /* Restore interrupts. */ - TX_RESTORE + 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); /* Lockout interrupts again. */ 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. */ /* Setup the new priority for this thread. */ @@ -340,14 +340,14 @@ UINT status; 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; @@ -395,7 +395,7 @@ UINT status; #endif } } - + /* Pickup the core index. */ core_index = thread_ptr -> tx_thread_smp_core_mapped; @@ -413,7 +413,7 @@ UINT status; /* Determine if this thread is not the next thread to execute. */ if (thread_ptr != _tx_thread_execute_ptr[core_index]) { - + /* Now determine if this thread was previously executing thread. */ if (thread_ptr == execute_ptr) { @@ -429,14 +429,14 @@ UINT status; /* Determine the lowest priority scheduled thread. */ lowest_priority = _tx_thread_smp_lowest_priority_get(); - /* Determine if this thread has a higher or same priority as the lowest priority + /* Determine if this thread has a higher or same priority as the lowest priority in the list. */ if (thread_ptr -> tx_thread_priority <= lowest_priority) { /* Yes, we need to rebalance to make it possible for this thread to execute. */ - - /* Determine if the thread with preemption-threshold thread has changed... and is + + /* Determine if the thread with preemption-threshold thread has changed... and is not the scheduled thread. */ if ((original_pt_thread != _tx_thread_preemption__threshold_scheduled) && (original_pt_thread != thread_ptr)) @@ -450,11 +450,11 @@ UINT status; /* Pickup the preemption-threshold thread. */ new_pt_thread = _tx_thread_preemption__threshold_scheduled; #endif - + /* Restore the original preemption-threshold thread. */ _tx_thread_preemption__threshold_scheduled = original_pt_thread; - - + + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* Determine if there is a new preemption-threshold thread to reverse. */ @@ -462,7 +462,7 @@ UINT status; { /* Clear the information associated with the new preemption-threshold thread. */ - + /* Pickup the priority. */ priority = new_pt_thread -> tx_thread_priority; @@ -473,7 +473,7 @@ UINT status; /* Calculate the bit map array index. */ map_index = new_priority/((UINT) 32); #endif - + /* Ensure that this thread's priority is clear in the preempt map. */ TX_MOD32_BIT_SET(priority, priority_bit) _tx_thread_preempted_maps[MAP_INDEX] = _tx_thread_preempted_maps[MAP_INDEX] & (~(priority_bit)); @@ -489,9 +489,9 @@ UINT status; } #endif } -#endif +#endif } - + /* Pickup the index. */ core_index = TX_SMP_CORE_ID; diff --git a/common_smp/src/tx_thread_relinquish.c b/common_smp/src/tx_thread_relinquish.c index 1cdaf846..69fc0a3e 100644 --- a/common_smp/src/tx_thread_relinquish.c +++ b/common_smp/src/tx_thread_relinquish.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,42 +32,42 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_relinquish PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_relinquish PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function determines if there is another higher or equal */ -/* priority, non-executing thread that can execute on this processor. */ -/* such a thread is found, the calling thread relinquishes control. */ -/* Otherwise, this function simply returns. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_system_return Return to the system */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function determines if there is another higher or equal */ +/* priority, non-executing thread that can execute on this processor. */ +/* such a thread is found, the calling thread relinquishes control. */ +/* Otherwise, this function simply returns. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_system_return Return to the system */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -78,7 +78,7 @@ VOID _tx_thread_relinquish(VOID) TX_INTERRUPT_SAVE_AREA -UINT priority; +UINT priority; TX_THREAD *thread_ptr; TX_THREAD *head_ptr; TX_THREAD *tail_ptr; @@ -93,7 +93,7 @@ ULONG excluded; UINT base_priority; UINT priority_bit_set; UINT next_preempted; -ULONG priority_bit; +ULONG priority_bit; ULONG priority_map; TX_THREAD *preempted_thread; #if TX_MAX_PRIORITIES > 32 @@ -124,7 +124,7 @@ UINT finished; _tx_timer_time_slice[core_index] = thread_ptr -> tx_thread_new_time_slice; #endif -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(thread_ptr) @@ -137,14 +137,14 @@ UINT finished; TX_EL_THREAD_RELINQUISH_INSERT /* Pickup the thread's priority. */ - priority = thread_ptr -> tx_thread_priority; + priority = thread_ptr -> tx_thread_priority; #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(0, 0, thread_ptr); #endif - + /* Pickup the next thread. */ next_thread = thread_ptr -> tx_thread_ready_next; @@ -163,7 +163,7 @@ UINT finished; /* Determine if this thread is at the head of the list. */ if (head_ptr == thread_ptr) { - + /* Simply move the head pointer to put this thread at the end of the ready list at this priority. */ _tx_thread_priority_list[priority] = next_thread; } @@ -188,22 +188,22 @@ UINT finished; /* Pickup the mapped core of the relinquishing thread - this can be different from the current core. */ mapped_core = thread_ptr -> tx_thread_smp_core_mapped; - + /* Determine if the relinquishing thread is no longer present in the execute list. */ if (thread_ptr != _tx_thread_execute_ptr[mapped_core]) { - - /* Yes, the thread is no longer mapped. Set the rebalance flag to determine if there is a new mapping due to moving + + /* Yes, the thread is no longer mapped. Set the rebalance flag to determine if there is a new mapping due to moving this thread to the end of the priority list. */ /* Set the rebalance flag to true. */ rebalance = TX_TRUE; } - + /* Determine if preemption-threshold is in force. */ else if (thread_ptr -> tx_thread_preempt_threshold == priority) { - + /* No preemption-threshold is in force. */ /* Determine if there is a thread at the same priority that isn't currently executing. */ @@ -212,7 +212,7 @@ UINT finished; /* Isolate the exclusion for this core. */ excluded = (next_thread -> tx_thread_smp_cores_excluded >> mapped_core) & ((ULONG) 1); - + /* Determine if the next thread has preemption-threshold set or is excluded from running on the mapped core. */ if ((next_thread -> tx_thread_preempt_threshold < next_thread -> tx_thread_priority) || @@ -221,7 +221,7 @@ UINT finished; /* Set the rebalance flag. */ rebalance = TX_TRUE; - + /* Get out of the loop. We need to rebalance the list when we detect preemption-threshold. */ break; } @@ -231,8 +231,8 @@ UINT finished; /* Is the next thread already in the execute list? */ if (next_thread != _tx_thread_execute_ptr[next_thread -> tx_thread_smp_core_mapped]) { - - /* No, we can place this thread in the position the relinquishing thread + + /* No, we can place this thread in the position the relinquishing thread was in. */ /* Remember this index in the thread control block. */ @@ -240,13 +240,13 @@ UINT finished; /* Setup the entry in the execution list. */ _tx_thread_execute_ptr[mapped_core] = next_thread; - + #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(1, 0, next_thread); #endif - + #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO /* Increment the number of thread relinquishes. */ @@ -259,7 +259,7 @@ UINT finished; _tx_thread_performance_non_idle_return_count++; #endif -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(next_thread) @@ -269,7 +269,7 @@ UINT finished; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif @@ -280,14 +280,14 @@ UINT finished; #ifdef TX_NOT_INTERRUPTABLE - + /* Restore interrupts. */ TX_RESTORE #endif /* Set the finished flag. */ - finished = TX_TRUE; - + finished = TX_TRUE; + } /* Move to the next thread at this priority. */ @@ -301,16 +301,16 @@ UINT finished; { /* No other thread is ready at this priority... simply return. */ - + #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(1, 0, thread_ptr); #endif - + /* Restore interrupts. */ TX_RESTORE - + /* Set the finished flag. */ finished = TX_TRUE; } @@ -324,13 +324,13 @@ UINT finished; rebalance = TX_TRUE; } } - + /* Determine if preemption-threshold is in force. */ if (thread_ptr -> tx_thread_preempt_threshold < priority) { - + /* Set the rebalance flag. */ - rebalance = TX_TRUE; + rebalance = TX_TRUE; #ifndef TX_DISABLE_PREEMPTION_THRESHOLD @@ -339,7 +339,7 @@ UINT finished; /* Calculate the index into the bit map array. */ map_index = priority/((UINT) 32); #endif - + /* Ensure that this thread's priority is clear in the preempt map. */ TX_MOD32_BIT_SET(priority, priority_bit) _tx_thread_preempted_maps[MAP_INDEX] = _tx_thread_preempted_maps[MAP_INDEX] & (~(priority_bit)); @@ -362,7 +362,7 @@ UINT finished; /* Does this thread have preemption-threshold? */ if (_tx_thread_preemption__threshold_scheduled == thread_ptr) { - + /* Yes, set the preempted thread to NULL. */ _tx_thread_preemption__threshold_scheduled = TX_NULL; } @@ -372,7 +372,7 @@ UINT finished; if (_tx_thread_preempted_map_active != ((ULONG) 0)) #else if (_tx_thread_preempted_maps[0] != ((ULONG) 0)) -#endif +#endif { #if TX_MAX_PRIORITIES > 32 @@ -400,20 +400,20 @@ UINT finished; priority_bit = (ULONG) priority_bit_set; /* Setup the highest priority preempted thread. */ - next_preempted = base_priority + priority_bit; + next_preempted = base_priority + priority_bit; /* Pickup the previously preempted thread. */ preempted_thread = _tx_thread_preemption_threshold_list[next_preempted]; - + /* Setup the preempted thread. */ _tx_thread_preemption__threshold_scheduled = preempted_thread; } #else - + /* Determine if this thread has preemption-threshold disabled. */ if (thread_ptr == _tx_thread_preemption__threshold_scheduled) { - + /* Clear the global preemption disable flag. */ _tx_thread_preemption__threshold_scheduled = TX_NULL; } @@ -433,7 +433,7 @@ UINT finished; /* Determine if we need to rebalance the execute list. */ if (rebalance == TX_TRUE) { - + /* Rebalance the excute list. */ _tx_thread_smp_rebalance_execute_list(core_index); } @@ -465,7 +465,7 @@ UINT finished; } #endif -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Pickup new thread pointer. */ thread_ptr = _tx_thread_execute_ptr[core_index]; @@ -478,7 +478,7 @@ UINT finished; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif @@ -488,7 +488,7 @@ UINT finished; _tx_thread_system_return(); #ifdef TX_NOT_INTERRUPTABLE - + /* Restore interrupts. */ TX_RESTORE #endif diff --git a/common_smp/src/tx_thread_reset.c b/common_smp/src/tx_thread_reset.c index f80a2463..5fc97e51 100644 --- a/common_smp/src/tx_thread_reset.c +++ b/common_smp/src/tx_thread_reset.c @@ -67,7 +67,9 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_reset(TX_THREAD *thread_ptr) @@ -133,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_smp/src/tx_thread_resume.c b/common_smp/src/tx_thread_resume.c index 123a884e..2352495c 100644 --- a/common_smp/src/tx_thread_resume.c +++ b/common_smp/src/tx_thread_resume.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,41 +32,41 @@ #include "tx_initialize.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_resume PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_resume PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes application resume thread services. Actual */ -/* thread resumption is performed in the core service. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to resume */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_system_resume Resume thread */ -/* _tx_thread_system_ni_resume Non-interruptable resume */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes application resume thread services. Actual */ +/* thread resumption is performed in the core service. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to resume */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_system_resume Resume thread */ +/* _tx_thread_system_ni_resume Non-interruptable resume */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -77,7 +77,7 @@ UINT _tx_thread_resume(TX_THREAD *thread_ptr) TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; UINT core_index; @@ -92,7 +92,7 @@ UINT core_index; /* Determine if the thread is suspended or in the process of suspending. If so, call the thread resume processing. */ - if (thread_ptr -> tx_thread_state == TX_SUSPENDED) + if (thread_ptr -> tx_thread_state == TX_SUSPENDED) { #ifdef TX_NOT_INTERRUPTABLE @@ -136,7 +136,7 @@ UINT core_index; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(14, 0, thread_ptr); #endif - + /* Get the core index. */ core_index = TX_SMP_CORE_ID; @@ -148,7 +148,7 @@ UINT core_index; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(15, 0, thread_ptr); #endif - } + } /* Setup successful return status. */ status = TX_SUCCESS; diff --git a/common_smp/src/tx_thread_shell_entry.c b/common_smp/src/tx_thread_shell_entry.c index bf4f2f5c..bec5a12d 100644 --- a/common_smp/src/tx_thread_shell_entry.c +++ b/common_smp/src/tx_thread_shell_entry.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,46 +29,48 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_shell_entry PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_shell_entry PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function calls the specified entry function of the thread. It */ -/* also provides a place for the thread's entry function to return. */ -/* If the thread returns, this function places the thread in a */ -/* "COMPLETED" state. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* thread_entry Thread's entry function */ -/* _tx_thread_system_suspend Thread suspension routine */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Initial thread stack frame */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function calls the specified entry function of the thread. It */ +/* also provides a place for the thread's entry function to return. */ +/* If the thread returns, this function places the thread in a */ +/* "COMPLETED" state. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* thread_entry Thread's entry function */ +/* _tx_thread_system_suspend Thread suspension routine */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Initial thread stack frame */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_thread_shell_entry(VOID) @@ -117,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_smp/src/tx_thread_sleep.c b/common_smp/src/tx_thread_sleep.c index 6b0eb434..c908134c 100644 --- a/common_smp/src/tx_thread_sleep.c +++ b/common_smp/src/tx_thread_sleep.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,43 +30,45 @@ #include "tx_thread.h" #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_sleep PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_sleep PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function handles application thread sleep requests. If the */ -/* sleep request was called from a non-thread, an error is returned. */ -/* */ -/* INPUT */ -/* */ -/* timer_ticks Number of timer ticks to sleep*/ -/* */ -/* OUTPUT */ -/* */ -/* status Return completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Actual thread suspension */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function handles application thread sleep requests. If the */ +/* sleep request was called from a non-thread, an error is returned. */ +/* */ +/* INPUT */ +/* */ +/* timer_ticks Number of timer ticks to sleep*/ +/* */ +/* OUTPUT */ +/* */ +/* status Return completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Actual thread suspension */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_sleep(ULONG timer_ticks) @@ -92,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; } @@ -116,7 +118,7 @@ TX_THREAD *thread_ptr; /* Restore interrupts. */ TX_RESTORE - + /* Illegal caller of this service. */ status = TX_CALLER_ERROR; } @@ -124,11 +126,11 @@ TX_THREAD *thread_ptr; /* Determine if the requested number of ticks is zero. */ else if (timer_ticks == ((ULONG) 0)) - { + { /* Restore interrupts. */ TX_RESTORE - + /* Just return with a successful status. */ status = TX_SUCCESS; } @@ -141,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) @@ -191,7 +193,7 @@ TX_THREAD *thread_ptr; status = thread_ptr -> tx_thread_suspend_status; } } - + /* Return completion status. */ return(status); } diff --git a/common_smp/src/tx_thread_smp_core_exclude.c b/common_smp/src/tx_thread_smp_core_exclude.c index cc973565..c3b79da5 100644 --- a/common_smp/src/tx_thread_smp_core_exclude.c +++ b/common_smp/src/tx_thread_smp_core_exclude.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread - High Level SMP Support */ /** */ @@ -32,44 +32,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_core_exclude PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_core_exclude PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function allows the application to exclude one or more cores */ -/* from executing the specified thread. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to the thread */ -/* exclusion_map Bit map of exclusion list, */ -/* where bit 0 set means that */ -/* this thread cannot run on */ -/* core0, etc. */ -/* */ -/* OUTPUT */ -/* */ -/* Status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Build execution list */ -/* _tx_thread_system_return System return */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function allows the application to exclude one or more cores */ +/* from executing the specified thread. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to the thread */ +/* exclusion_map Bit map of exclusion list, */ +/* where bit 0 set means that */ +/* this thread cannot run on */ +/* core0, etc. */ +/* */ +/* OUTPUT */ +/* */ +/* Status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Build execution list */ +/* _tx_thread_system_return System return */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -94,7 +94,7 @@ UINT status; /* First, make sure the thread pointer is valid. */ if (thread_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_THREAD_ERROR; } @@ -102,7 +102,7 @@ UINT status; /* Check for valid ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { - + /* Return pointer error. */ status = TX_THREAD_ERROR; } @@ -120,7 +120,7 @@ UINT status; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(2, 0, thread_ptr); #endif - + /* Build the bitmap for the last mapped core. */ mapped_core = (((ULONG) 1) << thread_ptr -> tx_thread_smp_core_mapped); @@ -134,14 +134,14 @@ UINT status; /* Determine if this is within the now available cores. */ if ((mapped_core & available_cores) == ((ULONG) 0)) { - + /* Determine if there are any cores available. */ if (available_cores == ((ULONG) 0)) { - + /* No cores are available, simply set the last running core to 0. */ thread_ptr -> tx_thread_smp_core_mapped = ((UINT) 0); - } + } else { @@ -168,8 +168,8 @@ UINT status; /* Determine if the thread is ready. */ if (thread_ptr -> tx_thread_state == TX_READY) - { - + { + /* Pickup the index. */ core_index = TX_SMP_CORE_ID; @@ -181,17 +181,17 @@ UINT status; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(3, 0, thread_ptr); #endif - + /* Determine if this thread needs to return to the system. */ - + /* Is there a difference between the current and execute thread pointers? */ - if (_tx_thread_execute_ptr[core_index] != _tx_thread_current_ptr[core_index]) + if (_tx_thread_execute_ptr[core_index] != _tx_thread_current_ptr[core_index]) { - + /* Yes, check to see if we are at the thread level. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { - + /* At the thread level, check for the preempt disable flag being set. */ if (_tx_thread_preempt_disable == ((UINT) 0)) { @@ -200,7 +200,7 @@ UINT status; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif @@ -221,16 +221,16 @@ UINT status; } } } - + /* Determine if the protection still needs to be restored. */ if (restore_needed == TX_TRUE) { - + /* Restore interrupts. */ TX_RESTORE } } - + /* Return status. */ return(status); } diff --git a/common_smp/src/tx_thread_smp_core_exclude_get.c b/common_smp/src/tx_thread_smp_core_exclude_get.c index 37e6c82a..e345dd9e 100644 --- a/common_smp/src/tx_thread_smp_core_exclude_get.c +++ b/common_smp/src/tx_thread_smp_core_exclude_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread - High Level SMP Support */ /** */ @@ -32,40 +32,40 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_core_exclude_get PROTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_core_exclude_get PROTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns the current exclusion list. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to the thread */ -/* exclusion_map_ptr Destination for the current */ -/* exclusion list */ -/* */ -/* OUTPUT */ -/* */ -/* Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function returns the current exclusion list. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to the thread */ +/* exclusion_map_ptr Destination for the current */ +/* exclusion list */ +/* */ +/* OUTPUT */ +/* */ +/* Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -80,7 +80,7 @@ UINT status; /* First, make sure the thread pointer is valid. */ if (thread_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_THREAD_ERROR; } @@ -88,7 +88,7 @@ UINT status; /* Check for valid ID. */ else if (thread_ptr -> tx_thread_id != TX_THREAD_ID) { - + /* Return pointer error. */ status = TX_THREAD_ERROR; } @@ -96,7 +96,7 @@ UINT status; /* Is the destination pointer NULL? */ else if (exclusion_map_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_PTR_ERROR; } @@ -105,11 +105,11 @@ UINT status; /* Save the current exclusion map in the destination. */ *exclusion_map_ptr = thread_ptr -> tx_thread_smp_cores_excluded; - + /* Return a successful status. */ status = TX_SUCCESS; } - + /* Return status. */ return(status); } diff --git a/common_smp/src/tx_thread_smp_current_state_set.c b/common_smp/src/tx_thread_smp_current_state_set.c index 5d4df849..2a74ad50 100644 --- a/common_smp/src/tx_thread_smp_current_state_set.c +++ b/common_smp/src/tx_thread_smp_current_state_set.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread - High Level SMP Support */ /** */ @@ -33,38 +33,38 @@ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_current_state_set PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_current_state_set PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is sets the current state to all of the cores. */ -/* */ -/* INPUT */ -/* */ -/* new_state New per-system state */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* This function is sets the current state to all of the cores. */ +/* */ +/* INPUT */ +/* */ +/* new_state New per-system state */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_kernel_enter ThreadX entry */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_kernel_enter ThreadX entry */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -72,15 +72,15 @@ /**************************************************************************/ void _tx_thread_smp_current_state_set(ULONG new_state) { - + UINT i; - + /* Initialize the state for each to initialization. */ i = ((UINT) (TX_THREAD_SMP_MAX_CORES-1)); do { - /* Set this core's state. */ + /* Set this core's state. */ _tx_thread_system_state[i] = new_state; if (i == ((UINT) 0)) @@ -91,7 +91,7 @@ UINT i; } else { - + /* Decrement the index. */ i--; } diff --git a/common_smp/src/tx_thread_smp_debug_entry_insert.c b/common_smp/src/tx_thread_smp_debug_entry_insert.c index 11213833..ac8caf9e 100644 --- a/common_smp/src/tx_thread_smp_debug_entry_insert.c +++ b/common_smp/src/tx_thread_smp_debug_entry_insert.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -85,42 +85,42 @@ TX_THREAD_SMP_DEBUG_ENTRY_INFO _tx_thread_smp_debug_info_array[TX_THREAD_SMP_MA ULONG _tx_thread_smp_debug_info_current_index; -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_debug_entry_insert PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_debug_entry_insert PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is responsible for making an entry in the circular */ -/* debug log. */ -/* */ -/* INPUT */ -/* */ -/* id ID of event */ -/* suspend Flag set to true for suspend */ -/* events */ -/* thread_ptr Specified thread */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* This function is responsible for making an entry in the circular */ +/* debug log. */ +/* */ +/* INPUT */ +/* */ +/* id ID of event */ +/* suspend Flag set to true for suspend */ +/* events */ +/* thread_ptr Specified thread */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_time_get Get global time stamp */ -/* */ -/* CALLED BY */ -/* */ -/* Internal routines */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_time_get Get global time stamp */ +/* */ +/* CALLED BY */ +/* */ +/* Internal routines */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -138,35 +138,35 @@ TX_THREAD *thread_ptr; /* Spin, if an error is detected. No sense in populating the debug after the error occurs. */ while (_tx_thread_smp_system_error) { - + /* Spin here! */ } /* Check for a bad current index. */ while (_tx_thread_smp_debug_info_current_index >= TX_THREAD_SMP_MAX_DEBUG_ENTRIES) { - + /* Spin here! */ } thread_ptr = (TX_THREAD *) thread_void_ptr; /* It is assumed that interrupts are locked out at this point. */ - + /* Setup pointer to debug entry. */ entry_ptr = &_tx_thread_smp_debug_info_array[_tx_thread_smp_debug_info_current_index++]; - + /* Check for wrap on the index. */ if (_tx_thread_smp_debug_info_current_index >= TX_THREAD_SMP_MAX_DEBUG_ENTRIES) { - + /* Wrap back to 0. */ _tx_thread_smp_debug_info_current_index = 0; } - + /* Get the index. */ core_index = TX_SMP_CORE_ID; - + /* We know at this point that multithreading and interrupts are disabled... so start populating the array. */ entry_ptr -> tx_thread_smp_debug_entry_id = id; entry_ptr -> tx_thread_smp_debug_entry_suspend = suspend; @@ -175,21 +175,21 @@ TX_THREAD *thread_ptr; entry_ptr -> tx_thread_smp_debug_entry_timer_clock = _tx_timer_system_clock; entry_ptr -> tx_thread_smp_debug_entry_core_index = core_index; entry_ptr -> tx_thread_smp_debug_entry_current_thread = _tx_thread_current_ptr[core_index]; - if (entry_ptr -> tx_thread_smp_debug_entry_current_thread) + if (entry_ptr -> tx_thread_smp_debug_entry_current_thread) { - + entry_ptr -> tx_thread_smp_debug_entry_thread_priority = (entry_ptr -> tx_thread_smp_debug_entry_current_thread) -> tx_thread_priority; entry_ptr -> tx_thread_smp_debug_entry_thread_threshold = (entry_ptr -> tx_thread_smp_debug_entry_current_thread) -> tx_thread_preempt_threshold; entry_ptr -> tx_thread_smp_debug_entry_thread_core_control = (entry_ptr -> tx_thread_smp_debug_entry_current_thread) -> tx_thread_smp_core_control; } else { - + entry_ptr -> tx_thread_smp_debug_entry_thread_priority = 0; entry_ptr -> tx_thread_smp_debug_entry_thread_threshold = 0; entry_ptr -> tx_thread_smp_debug_entry_thread_core_control = 0; } - + entry_ptr -> tx_thread_smp_debug_protection = _tx_thread_smp_protection; entry_ptr -> tx_thread_smp_debug_entry_preempt_disable = _tx_thread_preempt_disable; #ifndef TX_DISABLE_PREEMPTION_THRESHOLD @@ -208,7 +208,7 @@ TX_THREAD *thread_ptr; for (i = 0; i < _tx_thread_smp_max_cores; i++) #endif { - + /* Save the pointers. */ entry_ptr -> tx_thread_smp_debug_entry_current_threads[i] = _tx_thread_current_ptr[i]; entry_ptr -> tx_thread_smp_debug_entry_execute_threads[i] = _tx_thread_execute_ptr[i]; diff --git a/common_smp/src/tx_thread_smp_high_level_initialize.c b/common_smp/src/tx_thread_smp_high_level_initialize.c index b0082967..17cb6a37 100644 --- a/common_smp/src/tx_thread_smp_high_level_initialize.c +++ b/common_smp/src/tx_thread_smp_high_level_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Initialization */ /** */ @@ -33,39 +33,39 @@ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_high_level_initialize PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_high_level_initialize PORTABLE SMP */ /* 6.1.3 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the ThreadX SMP data structures and */ -/* CPU registers. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the ThreadX SMP data structures and */ +/* CPU registers. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_kernel_enter ThreadX entry */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_kernel_enter ThreadX entry */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -81,8 +81,8 @@ void _tx_thread_smp_high_level_initialize(void) /* Clear the system error flag. */ _tx_thread_smp_system_error = TX_FALSE; - /* 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_smp_current_state_set(TX_INITIALIZE_IN_PROGRESS); @@ -93,7 +93,7 @@ void _tx_thread_smp_high_level_initialize(void) _tx_thread_smp_protection.tx_thread_smp_protect_core = ((ULONG) 0xFFFFFFFFUL); /* Clear the thread schedule list. */ - TX_MEMSET(&_tx_thread_smp_schedule_list[0], 0, sizeof(_tx_thread_smp_schedule_list)); + TX_MEMSET(&_tx_thread_smp_schedule_list[0], 0, sizeof(_tx_thread_smp_schedule_list)); /* Initialize core list. */ TX_MEMSET(&_tx_thread_smp_protect_wait_list[0], 0xff, sizeof(_tx_thread_smp_protect_wait_list)); @@ -111,7 +111,7 @@ void _tx_thread_smp_high_level_initialize(void) to the compile-time maximum. */ if (_tx_thread_smp_max_cores == 0) { - + /* Default to the compile-time maximum. */ _tx_thread_smp_max_cores = TX_THREAD_SMP_MAX_CORES; } diff --git a/common_smp/src/tx_thread_smp_rebalance_execute_list.c b/common_smp/src/tx_thread_smp_rebalance_execute_list.c index e5518eb5..8bf90936 100644 --- a/common_smp/src/tx_thread_smp_rebalance_execute_list.c +++ b/common_smp/src/tx_thread_smp_rebalance_execute_list.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread - High Level SMP Support */ /** */ @@ -32,59 +32,59 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_smp_rebalance_execute_list PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_smp_rebalance_execute_list PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function is responsible for mapping ready ThreadX threads with */ -/* cores in the SMP . The basic idea is the standard ThreadX */ -/* ready list is traversed to build the _tx_thread_execute_ptr list. */ -/* Each index represents the and the corresponding entry in this */ -/* array contains the thread that should be executed by that core. If */ -/* the was previously running a different thread, it will be */ -/* preempted and restarted so it can run the new thread. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* This function is responsible for mapping ready ThreadX threads with */ +/* cores in the SMP . The basic idea is the standard ThreadX */ +/* ready list is traversed to build the _tx_thread_execute_ptr list. */ +/* Each index represents the and the corresponding entry in this */ +/* array contains the thread that should be executed by that core. If */ +/* the was previously running a different thread, it will be */ +/* preempted and restarted so it can run the new thread. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ -/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ -/* _tx_thread_smp_next_priority_find Find next priority with one */ -/* or more ready threads */ -/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ -/* schedule another thread */ -/* _tx_thread_smp_schedule_list_clear Clear the thread schedule list*/ -/* */ -/* CALLED BY */ -/* */ -/* _tx_mutex_priority_change Mutex priority change */ -/* _tx_thread_create Thread create */ -/* _tx_thread_preemption_change Thread preemption change */ -/* _tx_thread_priority_change Thread priority change */ -/* _tx_thread_relinquish Thread relinquish */ -/* _tx_thread_resume Thread resume */ -/* _tx_thread_smp_core_exclude Thread SMP core exclude */ -/* _tx_thread_system_resume Thread system resume */ -/* _tx_thread_system_suspend Thread suspend */ -/* _tx_thread_time_slice Thread time-slice */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ +/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ +/* _tx_thread_smp_next_priority_find Find next priority with one */ +/* or more ready threads */ +/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ +/* schedule another thread */ +/* _tx_thread_smp_schedule_list_clear Clear the thread schedule list*/ +/* */ +/* CALLED BY */ +/* */ +/* _tx_mutex_priority_change Mutex priority change */ +/* _tx_thread_create Thread create */ +/* _tx_thread_preemption_change Thread preemption change */ +/* _tx_thread_priority_change Thread priority change */ +/* _tx_thread_relinquish Thread relinquish */ +/* _tx_thread_resume Thread resume */ +/* _tx_thread_smp_core_exclude Thread SMP core exclude */ +/* _tx_thread_system_resume Thread system resume */ +/* _tx_thread_system_suspend Thread suspend */ +/* _tx_thread_time_slice Thread time-slice */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -127,7 +127,7 @@ UINT map_index; /* Clear the schedule list. */ _tx_thread_smp_schedule_list_clear(); - + /* Initialize the next priority to 0, the highest priority. */ next_priority = ((UINT) 0); @@ -148,10 +148,10 @@ UINT map_index; available_cores = possible_cores; /* Clear the schedule thread pointer. */ - schedule_thread = TX_NULL; + schedule_thread = TX_NULL; #ifdef TX_THREAD_SMP_EQUAL_PRIORITY - + /* Set the highest priority thread to NULL. */ highest_priority_thread = TX_NULL; #endif @@ -161,8 +161,8 @@ UINT map_index; loop_finished = TX_FALSE; do { - - /* Clear the pass complete flag, which is used to skip the remaining processing + + /* Clear the pass complete flag, which is used to skip the remaining processing of this loop on certain conditions. */ this_pass_complete = TX_FALSE; @@ -176,82 +176,82 @@ UINT map_index; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; this_pass_complete = TX_TRUE; } else - { + { /* Determine if a thread was executed with preemption-threshold set. */ if (preempted_thread != TX_NULL) { - - /* Yes, a thread was previously preempted. Let's first see if we reached the + + /* Yes, a thread was previously preempted. Let's first see if we reached the interrupted preemption-threshold level. */ if (next_priority >= preempted_thread -> tx_thread_preempt_threshold) { - + /* Yes, now lets see if we are within the preemption-threshold level. */ if (next_priority <= preempted_thread -> tx_thread_priority) { - + /* Yes, move the next priority to the preempted priority. */ next_priority = preempted_thread -> tx_thread_priority; - + /* Setup the schedule thread to the preempted thread. */ schedule_thread = preempted_thread; - + /* Start at the top of the loop. */ this_pass_complete = TX_TRUE; } else { - + /* Nothing else is allowed to execute after the preemption-threshold thread. */ next_priority = ((UINT) TX_MAX_PRIORITIES); - + /* Break out of loop. */ - loop_finished = TX_TRUE; + loop_finished = TX_TRUE; this_pass_complete = TX_TRUE; } } } - } + } /* Determine if this pass through the loop is already complete. */ if (this_pass_complete == TX_FALSE) - { - + { + /* Pickup the next thread to schedule. */ schedule_thread = _tx_thread_priority_list[next_priority]; } } - + /* Determine if this pass through the loop is already complete. */ if (this_pass_complete == TX_FALSE) - { + { /* Determine what the possible cores are for this thread. */ thread_possible_cores = schedule_thread -> tx_thread_smp_cores_allowed; - + /* Apply the current possible cores. */ thread_possible_cores = thread_possible_cores & (available_cores | possible_cores); - + /* Determine if it is possible to schedule this thread. */ if (thread_possible_cores == ((ULONG) 0)) { - + /* No, this thread can't be scheduled. */ /* Look at the next thread at the same priority level. */ schedule_thread = schedule_thread -> tx_thread_ready_next; - + /* Determine if this is the head of the list. */ if (schedule_thread == _tx_thread_priority_list[next_priority]) { - + /* Set the schedule thread to NULL to force examination of the next priority level. */ schedule_thread = TX_NULL; @@ -261,38 +261,38 @@ UINT map_index; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ - loop_finished = TX_TRUE; + loop_finished = TX_TRUE; } } } - else + else { /* It is possible to schedule this thread. */ - + /* Determine if this thread has preemption-threshold set. */ if (schedule_thread -> tx_thread_preempt_threshold < schedule_thread -> tx_thread_priority) { - + /* Yes, preemption-threshold is set. */ - /* Determine if the last priority is above the preemption-threshold. If not, we can't + /* Determine if the last priority is above the preemption-threshold. If not, we can't schedule this thread with preemption-threshold set. */ if ((last_priority >= schedule_thread -> tx_thread_preempt_threshold) && (i != ((UINT) 0))) { - /* A thread was found that violates the next thread to be scheduled's preemption-threshold. We will simply + /* A thread was found that violates the next thread to be scheduled's preemption-threshold. We will simply skip this thread and see if there is anything else we can schedule. */ - + /* Look at the next thread at the same priority level. */ schedule_thread = schedule_thread -> tx_thread_ready_next; - + /* Determine if this is the head of the list. */ if (schedule_thread == _tx_thread_priority_list[next_priority]) { - + /* Set the schedule thread to NULL to force examination of the next priority level. */ schedule_thread = TX_NULL; @@ -302,12 +302,12 @@ UINT map_index; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; } } - + /* Restart the loop. */ this_pass_complete = TX_TRUE; } @@ -315,18 +315,18 @@ UINT map_index; /* Determine if this pass through the loop is already complete. */ if (this_pass_complete == TX_FALSE) - { + { #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO /* Initialize index to an invalid value. */ j = ((UINT) TX_THREAD_SMP_MAX_CORES); #endif - + /* Determine if there is an available core for this thread to execute on. */ if ((thread_possible_cores & available_cores) != ((ULONG) 0)) { - + /* Pickup the last executed core for this thread. */ j = schedule_thread -> tx_thread_smp_core_mapped; @@ -350,23 +350,23 @@ UINT map_index; } else { - - /* Note that we know that the thread must have at least one core excluded at this point, + + /* Note that we know that the thread must have at least one core excluded at this point, since we didn't find a match and we have available cores. */ - /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room + /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room for this thread. */ /* Determine the possible core remapping attempt. */ test_possible_cores = possible_cores & ~(thread_possible_cores); /* Attempt to remap the cores in order to schedule this thread. */ - core = _tx_thread_smp_remap_solution_find(schedule_thread, available_cores, thread_possible_cores, test_possible_cores); - + core = _tx_thread_smp_remap_solution_find(schedule_thread, available_cores, thread_possible_cores, test_possible_cores); + /* Determine if remapping was successful. */ - if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) - { - + if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) + { + /* Yes, remapping was successful. Update the available cores accordingly. */ available_cores = available_cores & ~(((ULONG) 1) << core); } @@ -374,11 +374,11 @@ UINT map_index; { /* We couldn't assign the thread to any of the cores possible for the thread. */ - + /* Check to see if the thread is the last thread preempted. */ if (schedule_thread == preempted_thread) { - + /* To honor the preemption-threshold, we cannot schedule any more threads. */ loop_finished = TX_TRUE; } @@ -387,14 +387,14 @@ UINT map_index; /* update the available cores for the next pass so we don't waste time looking at them again! */ possible_cores = possible_cores & (~thread_possible_cores); - + /* No, we couldn't load the thread because none of the required cores were available. Look at the next thread at the same priority level. */ schedule_thread = schedule_thread -> tx_thread_ready_next; - + /* Determine if this is the head of the list. */ if (schedule_thread == _tx_thread_priority_list[next_priority]) { - + /* Set the schedule thread to NULL to force examination of the next priority level. */ schedule_thread = TX_NULL; @@ -404,13 +404,13 @@ UINT map_index; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; } } } - + /* Restart the loop. */ this_pass_complete = TX_TRUE; } @@ -418,14 +418,14 @@ UINT map_index; /* Determine if this pass through the loop is already complete. */ if (this_pass_complete == TX_FALSE) - { + { #ifdef TX_THREAD_SMP_EQUAL_PRIORITY - + /* Determine if this is the highest priority thread. */ if (highest_priority_thread == TX_NULL) { - + /* No highest priority yet, remember this thread. */ highest_priority_thread = schedule_thread; } @@ -439,35 +439,35 @@ UINT map_index; /* Determine if the thread was mapped. */ if (j != ((UINT) TX_THREAD_SMP_MAX_CORES)) { - + /* Pickup the currently mapped thread. */ mapped_thread = _tx_thread_execute_ptr[j]; /* Determine if preemption is present. */ if ((mapped_thread != TX_NULL) && (schedule_thread != mapped_thread)) - { + { /* Determine if the previously mapped thread is still ready. */ if (mapped_thread -> tx_thread_state == TX_READY) { - + /* Determine if the caller is an interrupt or from a thread. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { /* Caller is a thread, so this is a solicited preemption. */ _tx_thread_performance_solicited_preemption_count++; - + /* Increment the thread's solicited preemption counter. */ mapped_thread -> tx_thread_performance_solicited_preemption_count++; } - else + else { - + /* Is this an interrupt? */ if (_tx_thread_system_state[core_index] < TX_INITIALIZE_IN_PROGRESS) { - + /* Caller is an interrupt, so this is an interrupt preemption. */ _tx_thread_performance_interrupt_preemption_count++; @@ -483,7 +483,7 @@ UINT map_index; /* Determine if this thread has preemption-threshold set. */ if (schedule_thread -> tx_thread_preempt_threshold < schedule_thread -> tx_thread_priority) { - + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* mark the bit map to show that a thread with preemption-threshold has been executed. */ @@ -500,14 +500,14 @@ UINT map_index; /* Remember that this thread was executed with preemption-threshold set. */ TX_MOD32_BIT_SET(schedule_thread -> tx_thread_priority, priority_bit) _tx_thread_preempted_maps[MAP_INDEX] = _tx_thread_preempted_maps[MAP_INDEX] | priority_bit; - + /* Place the thread in the preempted list indicating preemption-threshold is in force. */ - _tx_thread_preemption_threshold_list[schedule_thread -> tx_thread_priority] = schedule_thread; + _tx_thread_preemption_threshold_list[schedule_thread -> tx_thread_priority] = schedule_thread; #endif /* Set the last thread with preemption-threshold enabled. */ _tx_thread_preemption__threshold_scheduled = schedule_thread; - + /* Now break out of the scheduling loop. */ loop_finished = TX_TRUE; } @@ -516,14 +516,14 @@ UINT map_index; /* Remember the last priority. */ last_priority = next_priority; - + /* Pickup the next ready thread at the current priority level. */ schedule_thread = schedule_thread -> tx_thread_ready_next; - + /* Determine if this is the head of the list, which implies that we have exhausted this priority level. */ if (schedule_thread == _tx_thread_priority_list[next_priority]) { - + /* Set the schedule thread to NULL to force examination of the next priority level. */ schedule_thread = TX_NULL; @@ -531,12 +531,12 @@ UINT map_index; next_priority++; #ifdef TX_THREAD_SMP_EQUAL_PRIORITY - + /* Determine if there is a highest priority thread. */ if (highest_priority_thread) { - - /* Yes, break out of the loop, since only same priority threads can be + + /* Yes, break out of the loop, since only same priority threads can be scheduled in this mode. */ loop_finished = TX_TRUE; } @@ -545,7 +545,7 @@ UINT map_index; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; } @@ -559,7 +559,7 @@ UINT map_index; /* Determine if the loop is finished. */ if (loop_finished == TX_TRUE) { - + /* Finished, break the loop. */ break; } diff --git a/common_smp/src/tx_thread_smp_utilities.c b/common_smp/src/tx_thread_smp_utilities.c index f7b5749b..8543e7be 100644 --- a/common_smp/src/tx_thread_smp_utilities.c +++ b/common_smp/src/tx_thread_smp_utilities.c @@ -12,7 +12,7 @@ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** ThreadX Component */ /** */ /** Thread */ @@ -39,122 +39,122 @@ UINT _tx_thread_lowest_set_bit_calculate(ULONG map) UINT bit_set; if ((map & ((ULONG) 0x1)) != ((ULONG) 0)) - { - bit_set = ((UINT) 0); - } - else - { - map = map & (ULONG) ((~map) + ((ULONG) 1)); - if (map < ((ULONG) 0x100)) - { - bit_set = ((UINT) 1); - } - else if (map < ((ULONG) 0x10000)) - { - bit_set = ((UINT) 9); - map = map >> ((UINT) 8); - } - else if (map < ((ULONG) 0x01000000)) - { - bit_set = ((UINT) 17); - map = map >> ((UINT) 16); - } - else - { - bit_set = ((UINT) 25); - map = map >> ((UINT) 24); - } - if (map >= ((ULONG) 0x10)) - { - map = map >> ((UINT) 4); - bit_set = bit_set + ((UINT) 4); - } - if (map >= ((ULONG) 0x4)) - { - map = map >> ((UINT) 2); - bit_set = bit_set + ((UINT) 2); - } - bit_set = bit_set - (UINT) (map & (ULONG) 0x1); + { + bit_set = ((UINT) 0); + } + else + { + map = map & (ULONG) ((~map) + ((ULONG) 1)); + if (map < ((ULONG) 0x100)) + { + bit_set = ((UINT) 1); + } + else if (map < ((ULONG) 0x10000)) + { + bit_set = ((UINT) 9); + map = map >> ((UINT) 8); + } + else if (map < ((ULONG) 0x01000000)) + { + bit_set = ((UINT) 17); + map = map >> ((UINT) 16); + } + else + { + bit_set = ((UINT) 25); + map = map >> ((UINT) 24); + } + if (map >= ((ULONG) 0x10)) + { + map = map >> ((UINT) 4); + bit_set = bit_set + ((UINT) 4); + } + if (map >= ((ULONG) 0x4)) + { + map = map >> ((UINT) 2); + bit_set = bit_set + ((UINT) 2); + } + bit_set = bit_set - (UINT) (map & (ULONG) 0x1); } - + return(bit_set); } -/* Define the next priority macro. Note, that this may be overridden +/* Define the next priority macro. Note, that this may be overridden by a port specific definition. */ - + #if TX_MAX_PRIORITIES > 32 -UINT _tx_thread_smp_next_priority_find(UINT priority) -{ -ULONG map_index; -ULONG local_priority_map_active; -ULONG local_priority_map; -ULONG priority_bit; -ULONG first_bit_set; -ULONG found_priority; +UINT _tx_thread_smp_next_priority_find(UINT priority) +{ +ULONG map_index; +ULONG local_priority_map_active; +ULONG local_priority_map; +ULONG priority_bit; +ULONG first_bit_set; +ULONG found_priority; - found_priority = ((UINT) TX_MAX_PRIORITIES); - if (priority < ((UINT) TX_MAX_PRIORITIES)) - { - map_index = priority/((UINT) 32); - local_priority_map = _tx_thread_priority_maps[map_index]; - priority_bit = (((ULONG) 1) << (priority % ((UINT) 32))); - local_priority_map = local_priority_map & ~(priority_bit - ((UINT)1)); - if (local_priority_map != ((ULONG) 0)) - { - TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) - found_priority = (map_index * ((UINT) 32)) + first_bit_set; - } - else - { + found_priority = ((UINT) TX_MAX_PRIORITIES); + if (priority < ((UINT) TX_MAX_PRIORITIES)) + { + map_index = priority/((UINT) 32); + local_priority_map = _tx_thread_priority_maps[map_index]; + priority_bit = (((ULONG) 1) << (priority % ((UINT) 32))); + local_priority_map = local_priority_map & ~(priority_bit - ((UINT)1)); + if (local_priority_map != ((ULONG) 0)) + { + TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) + found_priority = (map_index * ((UINT) 32)) + first_bit_set; + } + else + { /* Move to next map index. */ - map_index++; - if (map_index < (((UINT) TX_MAX_PRIORITIES)/((UINT) 32))) - { - priority_bit = (((ULONG) 1) << (map_index)); - local_priority_map_active = _tx_thread_priority_map_active & ~(priority_bit - ((UINT) 1)); - if (local_priority_map_active != ((ULONG) 0)) - { - TX_LOWEST_SET_BIT_CALCULATE(local_priority_map_active, map_index) - local_priority_map = _tx_thread_priority_maps[map_index]; - TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) - found_priority = (map_index * ((UINT) 32)) + first_bit_set; - } - } - } - } + map_index++; + if (map_index < (((UINT) TX_MAX_PRIORITIES)/((UINT) 32))) + { + priority_bit = (((ULONG) 1) << (map_index)); + local_priority_map_active = _tx_thread_priority_map_active & ~(priority_bit - ((UINT) 1)); + if (local_priority_map_active != ((ULONG) 0)) + { + TX_LOWEST_SET_BIT_CALCULATE(local_priority_map_active, map_index) + local_priority_map = _tx_thread_priority_maps[map_index]; + TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) + found_priority = (map_index * ((UINT) 32)) + first_bit_set; + } + } + } + } return(found_priority); } #else -UINT _tx_thread_smp_next_priority_find(UINT priority) -{ -UINT first_bit_set; -ULONG local_priority_map; +UINT _tx_thread_smp_next_priority_find(UINT priority) +{ +UINT first_bit_set; +ULONG local_priority_map; UINT next_priority; - local_priority_map = _tx_thread_priority_maps[0]; - local_priority_map = local_priority_map >> priority; + local_priority_map = _tx_thread_priority_maps[0]; + local_priority_map = local_priority_map >> priority; next_priority = priority; - if (local_priority_map == ((ULONG) 0)) - { - next_priority = ((UINT) TX_MAX_PRIORITIES); - } - else - { - if (next_priority >= ((UINT) TX_MAX_PRIORITIES)) - { - next_priority = ((UINT) TX_MAX_PRIORITIES); - } - else - { - TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) - next_priority = priority + first_bit_set; - } - } - + if (local_priority_map == ((ULONG) 0)) + { + next_priority = ((UINT) TX_MAX_PRIORITIES); + } + else + { + if (next_priority >= ((UINT) TX_MAX_PRIORITIES)) + { + next_priority = ((UINT) TX_MAX_PRIORITIES); + } + else + { + TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set) + next_priority = priority + first_bit_set; + } + } + return(next_priority); } #endif @@ -180,7 +180,7 @@ UINT i; #if TX_THREAD_SMP_MAX_CORES > 5 _tx_thread_smp_schedule_list[5] = TX_NULL; #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to clear the remainder of the schedule list. */ i = ((UINT) 6); @@ -194,7 +194,7 @@ UINT i; { /* Clear entry in schedule list. */ _tx_thread_smp_schedule_list[i] = TX_NULL; - + /* Move to next index. */ i++; } @@ -225,7 +225,7 @@ UINT j; #if TX_THREAD_SMP_MAX_CORES > 5 _tx_thread_execute_ptr[5] = TX_NULL; #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to clear the remainder of the execute list. */ j = ((UINT) 6); @@ -237,10 +237,10 @@ UINT j; while (j < _tx_thread_smp_max_cores) #endif { - + /* Clear entry in execute list. */ _tx_thread_execute_ptr[j] = TX_NULL; - + /* Move to next index. */ j++; } @@ -271,7 +271,7 @@ UINT j; #if TX_THREAD_SMP_MAX_CORES > 5 _tx_thread_smp_schedule_list[5] = _tx_thread_execute_ptr[5]; #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to setup the remainder of the schedule list. */ j = ((UINT) 6); @@ -282,10 +282,10 @@ UINT j; while (j < _tx_thread_smp_max_cores) #endif { - + /* Setup entry in schedule list. */ _tx_thread_smp_schedule_list[j] = _tx_thread_execute_ptr[j]; - + /* Move to next index. */ j++; } @@ -336,7 +336,7 @@ TX_THREAD *current_thread; VOID _tx_thread_smp_core_wakeup(UINT current_core, UINT target_core) { - /* Determine if the core specified is not the current core - no need to wakeup the + /* Determine if the core specified is not the current core - no need to wakeup the current core. */ if (target_core != current_core) { @@ -345,7 +345,7 @@ VOID _tx_thread_smp_core_wakeup(UINT current_core, UINT target_core) TX_THREAD_SMP_WAKEUP(target_core); } } -#endif +#endif VOID _tx_thread_smp_execute_list_setup(UINT core_index) @@ -430,7 +430,7 @@ ULONG available_cores; available_cores = available_cores | ((ULONG) 0x20); } #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to setup the remainder of the schedule list. */ j = ((UINT) 6); @@ -441,13 +441,13 @@ ULONG available_cores; while (j < _tx_thread_smp_max_cores) #endif { - + /* Determine if this core is available. */ if (_tx_thread_execute_ptr[j] == TX_NULL) { available_cores = available_cores | (((ULONG) 1) << j); } - + /* Move to next core. */ j++; } @@ -507,7 +507,7 @@ TX_THREAD *thread_ptr; possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed; } #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to setup the remainder of the schedule list. */ j = ((UINT) 6); @@ -518,14 +518,14 @@ TX_THREAD *thread_ptr; while (j < _tx_thread_smp_max_cores) #endif { - + /* Determine if this core is available. */ thread_ptr = _tx_thread_execute_ptr[j]; if (thread_ptr != TX_NULL) { possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed; } - + /* Move to next core. */ j++; } @@ -603,7 +603,7 @@ UINT lowest_priority; } } #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to setup the remainder of the schedule list. */ j = ((UINT) 6); @@ -614,19 +614,19 @@ UINT lowest_priority; while (j < _tx_thread_smp_max_cores) #endif { - + /* Determine if this core has a thread scheduled. */ thread_ptr = _tx_thread_execute_ptr[j]; if (thread_ptr != TX_NULL) { - + /* Is this the new lowest priority? */ if (thread_ptr -> tx_thread_priority > lowest_priority) { lowest_priority = thread_ptr -> tx_thread_priority; } } - + /* Move to next core. */ j++; } @@ -652,31 +652,31 @@ UINT core_queue[TX_THREAD_SMP_MAX_CORES-1]; TX_THREAD *thread_ptr; TX_THREAD *last_thread; TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES]; - + /* Clear the last thread cores in the search. */ last_thread_cores = ((ULONG) 0); - + /* Set the last thread pointer to NULL. */ last_thread = TX_NULL; - + /* Setup the core queue indices. */ queue_first = ((UINT) 0); queue_last = ((UINT) 0); - - /* Build a list of possible cores for this thread to execute on, starting + + /* Build a list of possible cores for this thread to execute on, starting with the previously mapped core. */ core = schedule_thread -> tx_thread_smp_core_mapped; if ((thread_possible_cores & (((ULONG) 1) << core)) != ((ULONG) 0)) { - + /* Remember this potential mapping. */ thread_remap_list[core] = schedule_thread; core_queue[queue_last] = core; - + /* Move to next slot. */ queue_last++; - + /* Clear this core. */ thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core); } @@ -688,96 +688,96 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES]; /* Determine the first possible core. */ test_cores = thread_possible_cores; TX_LOWEST_SET_BIT_CALCULATE(test_cores, core) - + /* Clear this core. */ thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core); - + /* Remember this potential mapping. */ thread_remap_list[core] = schedule_thread; core_queue[queue_last] = core; - + /* Move to next slot. */ queue_last++; - } + } /* Loop to evaluate the potential thread mappings, against what is already mapped. */ - do + do { /* Pickup the next entry. */ core = core_queue[queue_first]; - + /* Move to next slot. */ queue_first++; - + /* Retrieve the thread from the current mapping. */ thread_ptr = _tx_thread_smp_schedule_list[core]; /* Determine if there is a thread currently mapped to this core. */ if (thread_ptr != TX_NULL) { - + /* Determine the cores available for this thread. */ thread_possible_cores = thread_ptr -> tx_thread_smp_cores_allowed; thread_possible_cores = test_possible_cores & thread_possible_cores; - + /* Are there any possible cores for this thread? */ - if (thread_possible_cores != ((ULONG) 0)) + if (thread_possible_cores != ((ULONG) 0)) { - + /* Determine if there are cores available for this thread. */ if ((thread_possible_cores & available_cores) != ((ULONG) 0)) { - + /* Yes, remember the final thread and cores that are valid for this thread. */ last_thread_cores = thread_possible_cores & available_cores; last_thread = thread_ptr; - + /* We are done - get out of the loop! */ break; } else { - + /* Remove cores that will be added to the list. */ test_possible_cores = test_possible_cores & ~(thread_possible_cores); - + /* Loop to add this thread to the potential mapping list. */ - do + do { - + /* Calculate the core. */ test_cores = thread_possible_cores; TX_LOWEST_SET_BIT_CALCULATE(test_cores, core) - + /* Clear this core. */ thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core); - + /* Remember this thread for remapping. */ thread_remap_list[core] = thread_ptr; - + /* Remember this core. */ core_queue[queue_last] = core; - + /* Move to next slot. */ queue_last++; - + } while (thread_possible_cores != ((ULONG) 0)); } } } } while (queue_first != queue_last); - + /* Was a remapping solution found? */ if (last_thread != TX_NULL) { - + /* Pickup the core of the last thread to remap. */ core = last_thread -> tx_thread_smp_core_mapped; - + /* Pickup the thread from the remapping list. */ thread_ptr = thread_remap_list[core]; - + /* Loop until we arrive at the thread we have been trying to map. */ while (thread_ptr != schedule_thread) { @@ -787,40 +787,40 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES]; /* Remember the previous core. */ previous_core = core; - - /* Pickup the core of thread to remap. */ + + /* Pickup the core of thread to remap. */ core = thread_ptr -> tx_thread_smp_core_mapped; - + /* Save the new core mapping for this thread. */ thread_ptr -> tx_thread_smp_core_mapped = previous_core; - + /* Move the next thread. */ thread_ptr = thread_remap_list[core]; } - + /* Save the remaining thread in the updated schedule list. */ _tx_thread_smp_schedule_list[core] = thread_ptr; /* Update this thread's core mapping. */ thread_ptr -> tx_thread_smp_core_mapped = core; - + /* Finally, setup the last thread in the remapping solution. */ test_cores = last_thread_cores; TX_LOWEST_SET_BIT_CALCULATE(test_cores, core) - + /* Setup the last thread. */ _tx_thread_smp_schedule_list[core] = last_thread; - + /* Remember the core mapping for this thread. */ last_thread -> tx_thread_smp_core_mapped = core; } else { - + /* Set core to the maximum value in order to signal a remapping solution was not found. */ core = ((UINT) TX_THREAD_SMP_MAX_CORES); } - + /* Return core to the caller. */ return(core); } @@ -850,7 +850,7 @@ ULONG possible_cores = ((ULONG) 0); #if TX_THREAD_SMP_MAX_CORES > 5 possible_preemption_list[5] = TX_NULL; #if TX_THREAD_SMP_MAX_CORES > 6 - + /* Loop to clear the remainder of the possible preemption list. */ j = ((UINT) 6); @@ -862,10 +862,10 @@ ULONG possible_cores = ((ULONG) 0); while (j < _tx_thread_smp_max_cores) #endif { - + /* Clear entry in possible preemption list. */ possible_preemption_list[j] = TX_NULL; - + /* Move to next core. */ j++; } @@ -889,18 +889,18 @@ ULONG possible_cores = ((ULONG) 0); /* Pickup the currently mapped thread. */ thread_ptr = _tx_thread_execute_ptr[i]; - + /* Is there a thread scheduled for this core? */ if (thread_ptr != TX_NULL) { - + /* Update the possible cores bit map. */ possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed; /* Can this thread be preempted? */ if (priority < thread_ptr -> tx_thread_priority) { - + /* Thread that can be added to the preemption possible list. */ /* Yes, this scheduled thread is lower priority, so add it to the preemption possible list. */ @@ -910,7 +910,7 @@ ULONG possible_cores = ((ULONG) 0); j++; } } - + /* Move to next core. */ i++; } @@ -923,7 +923,7 @@ ULONG possible_cores = ((ULONG) 0); i = ((UINT) 0); do { - + /* Pickup preemptable thread. */ thread_ptr = possible_preemption_list[i]; @@ -933,47 +933,47 @@ ULONG possible_cores = ((ULONG) 0); /* Loop to get the lowest priority thread at the front of the list. */ while (k < j) { - + /* Pickup the next thread to evaluate. */ next_thread = possible_preemption_list[k]; - + /* Is this thread lower priority? */ if (next_thread -> tx_thread_priority > thread_ptr -> tx_thread_priority) { - + /* Yes, swap the threads. */ possible_preemption_list[i] = next_thread; possible_preemption_list[k] = thread_ptr; thread_ptr = next_thread; } - else + else { /* Compare the thread priorities. */ if (next_thread -> tx_thread_priority == thread_ptr -> tx_thread_priority) { - + /* Equal priority threads... see which is in the ready list first. */ search_thread = thread_ptr -> tx_thread_ready_next; - + /* Pickup the list head. */ list_head = _tx_thread_priority_list[thread_ptr -> tx_thread_priority]; - + /* Now loop to see if the next thread is after the current thread preemption. */ while (search_thread != list_head) { - + /* Have we found the next thread? */ if (search_thread == next_thread) { - + /* Yes, swap the threads. */ possible_preemption_list[i] = next_thread; possible_preemption_list[k] = thread_ptr; thread_ptr = next_thread; break; } - + /* Move to the next thread. */ search_thread = search_thread -> tx_thread_ready_next; } @@ -983,7 +983,7 @@ ULONG possible_cores = ((ULONG) 0); k++; } } - + /* We have found the lowest priority thread to preempt, now find the next lowest. */ i++; } @@ -999,15 +999,15 @@ VOID _tx_thread_smp_simple_priority_change(TX_THREAD *thread_ptr, UINT new_prio UINT priority; ULONG priority_bit; -TX_THREAD *head_ptr; -TX_THREAD *tail_ptr; +TX_THREAD *head_ptr; +TX_THREAD *tail_ptr; #if TX_MAX_PRIORITIES > 32 UINT map_index; #endif /* Pickup the priority. */ priority = thread_ptr -> tx_thread_priority; - + /* Determine if there are other threads at this priority that are ready. */ if (thread_ptr -> tx_thread_ready_next != thread_ptr) @@ -1030,7 +1030,7 @@ UINT map_index; 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; @@ -1061,21 +1061,21 @@ UINT map_index; 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; } /* Now, place the thread at the new priority level. */ - + /* Determine if there are other threads at this priority that are ready. */ head_ptr = _tx_thread_priority_list[new_priority]; @@ -1090,7 +1090,7 @@ UINT map_index; head_ptr -> tx_thread_ready_previous = thread_ptr; thread_ptr -> tx_thread_ready_previous = tail_ptr; thread_ptr -> tx_thread_ready_next = head_ptr; - } + } else { diff --git a/common_smp/src/tx_thread_stack_analyze.c b/common_smp/src/tx_thread_stack_analyze.c index 70fd4838..886e4d9e 100644 --- a/common_smp/src/tx_thread_stack_analyze.c +++ b/common_smp/src/tx_thread_stack_analyze.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,43 +29,45 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_stack_analyze PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_stack_analyze PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function analyzes the stack to calculate the highest stack */ -/* pointer in the thread's stack. This can then be used to derive the */ -/* minimum amount of stack left for any given thread. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Thread control block pointer */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* ThreadX internal code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function analyzes the stack to calculate the highest stack */ +/* pointer in the thread's stack. This can then be used to derive the */ +/* minimum amount of stack left for any given thread. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Thread control block pointer */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* ThreadX internal code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_thread_stack_analyze(TX_THREAD *thread_ptr) @@ -92,22 +94,22 @@ 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) { - /* Pickup the highest stack pointer. */ + /* Pickup the highest stack pointer. */ stack_highest = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr); /* 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 { @@ -135,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); } @@ -151,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_smp/src/tx_thread_stack_error_handler.c b/common_smp/src/tx_thread_stack_error_handler.c index b03d64fb..6b0ee82d 100644 --- a/common_smp/src/tx_thread_stack_error_handler.c +++ b/common_smp/src/tx_thread_stack_error_handler.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,39 +30,39 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_stack_error_handler PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_stack_error_handler PORTABLE C */ /* 6.1.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes stack errors detected during run-time. The */ -/* processing currently consists of a spin loop. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Thread control block pointer */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* ThreadX internal code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes stack errors detected during run-time. The */ +/* processing currently consists of a spin loop. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Thread control block pointer */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* ThreadX internal code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -100,7 +100,7 @@ TX_INTERRUPT_SAVE_AREA /* Disable interrupts. */ TX_DISABLE - + /* Restore interrupts. */ TX_RESTORE } diff --git a/common_smp/src/tx_thread_stack_error_notify.c b/common_smp/src/tx_thread_stack_error_notify.c index 957bff06..720eb56b 100644 --- a/common_smp/src/tx_thread_stack_error_notify.c +++ b/common_smp/src/tx_thread_stack_error_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,43 +32,43 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_stack_error_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_stack_error_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers an application stack error handler. If */ -/* ThreadX detects a stack error, this application handler is called. */ -/* */ -/* Note: stack checking must be enabled for this routine to serve any */ -/* purpose via the TX_ENABLE_STACK_CHECKING define. */ -/* */ -/* INPUT */ -/* */ -/* stack_error_handler Pointer to stack error */ -/* handler, TX_NULL to disable */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function registers an application stack error handler. If */ +/* ThreadX detects a stack error, this application handler is called. */ +/* */ +/* Note: stack checking must be enabled for this routine to serve any */ +/* purpose via the TX_ENABLE_STACK_CHECKING define. */ +/* */ +/* INPUT */ +/* */ +/* stack_error_handler Pointer to stack error */ +/* handler, TX_NULL to disable */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -91,7 +91,7 @@ UINT status; } else { - + /* Stack checking is not enabled, just return an error. */ status = TX_FEATURE_NOT_ENABLED; } diff --git a/common_smp/src/tx_thread_suspend.c b/common_smp/src/tx_thread_suspend.c index 5aab3796..95560e37 100644 --- a/common_smp/src/tx_thread_suspend.c +++ b/common_smp/src/tx_thread_suspend.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -31,41 +31,41 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_suspend PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_suspend PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function handles application suspend requests. If the suspend */ -/* requires actual processing, this function calls the actual suspend */ -/* thread routine. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* status Return completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_suspend Actual thread suspension */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function handles application suspend requests. If the suspend */ +/* requires actual processing, this function calls the actual suspend */ +/* thread routine. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* status Return completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_suspend Actual thread suspension */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -77,7 +77,7 @@ UINT _tx_thread_suspend(TX_THREAD *thread_ptr) TX_INTERRUPT_SAVE_AREA TX_THREAD *current_thread; -UINT status; +UINT status; UINT core_index; @@ -106,13 +106,13 @@ UINT core_index; /* Determine if we are in a thread context. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { - + /* Yes, we are in a thread context. */ /* Determine if the current thread is also the suspending thread. */ if (current_thread == thread_ptr) { - + /* Determine if the preempt disable flag is non-zero. */ if (_tx_thread_preempt_disable != ((UINT) 0)) { @@ -125,7 +125,7 @@ UINT core_index; /* Determine if the status is still successful. */ if (status == TX_SUCCESS) - { + { /* Set the state to suspended. */ thread_ptr -> tx_thread_state = TX_SUSPENDED; @@ -159,14 +159,14 @@ UINT core_index; /* Disable interrupts. */ TX_DISABLE - + /* Return success. */ status = TX_SUCCESS; #else /* If MISRA is not enabled, return directly. */ return(TX_SUCCESS); -#endif +#endif } } else if (thread_ptr -> tx_thread_state == TX_TERMINATED) @@ -200,7 +200,7 @@ UINT core_index; /* 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); } diff --git a/common_smp/src/tx_thread_system_preempt_check.c b/common_smp/src/tx_thread_system_preempt_check.c index d69ddbc0..cdc7dc0a 100644 --- a/common_smp/src/tx_thread_system_preempt_check.c +++ b/common_smp/src/tx_thread_system_preempt_check.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,40 +30,40 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_system_preempt_check PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_system_preempt_check PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for preemption that could have occurred as a */ -/* result scheduling activities occurring while the preempt disable */ -/* flag was set. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_return Return to the system */ -/* */ -/* CALLED BY */ -/* */ +/* */ +/* This function checks for preemption that could have occurred as a */ +/* result scheduling activities occurring while the preempt disable */ +/* flag was set. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_return Return to the system */ +/* */ +/* CALLED BY */ +/* */ /* Other ThreadX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -90,18 +90,18 @@ UINT restore_needed; /* Determine if the call is from initialization, an ISR or if the preempt disable flag is set. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { - + /* Ensure the preempt disable flag is not set. */ if (_tx_thread_preempt_disable == ((UINT) 0)) { - + /* Thread execution - now determine if preemption should take place. */ if (_tx_thread_current_ptr[core_index] != _tx_thread_execute_ptr[core_index]) { /* Yes, thread preemption should take place. */ -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING TX_THREAD *thread_ptr; /* Pickup the next execute pointer. */ @@ -137,14 +137,14 @@ UINT restore_needed; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif /* Return to the system so the higher priority thread can be scheduled. */ _tx_thread_system_return(); - + #ifdef TX_NOT_INTERRUPTABLE /* Restore interrupts. */ diff --git a/common_smp/src/tx_thread_system_resume.c b/common_smp/src/tx_thread_system_resume.c index fea06599..6ca269b2 100644 --- a/common_smp/src/tx_thread_system_resume.c +++ b/common_smp/src/tx_thread_system_resume.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -33,66 +33,66 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_system_resume PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_system_resume PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the specified thread on the list of ready */ -/* threads at the thread's specific priority. If a thread preemption */ -/* is detected, this function returns a TX_TRUE. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to resume */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_available_cores_get Get available cores bitmap */ -/* _tx_thread_smp_core_preempt Preempt core for new thread */ -/* _tx_thread_smp_core_wakeup Wakeup other core */ -/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ -/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ -/* _tx_thread_smp_core_interrupt Interrupt other core */ -/* _tx_thread_smp_lowest_priority_get Get lowest priority scheduled */ -/* thread */ -/* _tx_thread_smp_next_priority_find Find next priority with one */ -/* or more ready threads */ -/* _tx_thread_smp_possible_cores_get Get possible cores bitmap */ -/* _tx_thread_smp_preemptable_threads_get */ -/* Get list of thread preemption */ -/* possibilities */ -/* [_tx_thread_smp_protect] Get protection */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ -/* schedule another thread */ -/* _tx_thread_smp_schedule_list_clear Clear the thread schedule list*/ -/* _tx_thread_smp_schedule_list_setup Inherit schedule list from */ -/* execute list */ -/* _tx_thread_system_return Return to the system */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_create Thread create function */ -/* _tx_thread_priority_change Thread priority change */ -/* _tx_thread_resume Application resume service */ -/* _tx_thread_timeout Thread timeout */ -/* _tx_thread_wait_abort Thread wait abort */ +/* */ +/* This function places the specified thread on the list of ready */ +/* threads at the thread's specific priority. If a thread preemption */ +/* is detected, this function returns a TX_TRUE. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to resume */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_available_cores_get Get available cores bitmap */ +/* _tx_thread_smp_core_preempt Preempt core for new thread */ +/* _tx_thread_smp_core_wakeup Wakeup other core */ +/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ +/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ +/* _tx_thread_smp_core_interrupt Interrupt other core */ +/* _tx_thread_smp_lowest_priority_get Get lowest priority scheduled */ +/* thread */ +/* _tx_thread_smp_next_priority_find Find next priority with one */ +/* or more ready threads */ +/* _tx_thread_smp_possible_cores_get Get possible cores bitmap */ +/* _tx_thread_smp_preemptable_threads_get */ +/* Get list of thread preemption */ +/* possibilities */ +/* [_tx_thread_smp_protect] Get protection */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ +/* schedule another thread */ +/* _tx_thread_smp_schedule_list_clear Clear the thread schedule list*/ +/* _tx_thread_smp_schedule_list_setup Inherit schedule list from */ +/* execute list */ +/* _tx_thread_system_return Return to the system */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_create Thread create function */ +/* _tx_thread_priority_change Thread priority change */ +/* _tx_thread_resume Application resume service */ +/* _tx_thread_timeout Thread timeout */ +/* _tx_thread_wait_abort Thread wait abort */ /* Other ThreadX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -107,15 +107,15 @@ TX_INTERRUPT_SAVE_AREA #endif -UINT priority; +UINT priority; ULONG priority_bit; -TX_THREAD *head_ptr; -TX_THREAD *tail_ptr; +TX_THREAD *head_ptr; +TX_THREAD *tail_ptr; UINT core_index; #ifndef TX_THREAD_SMP_EQUAL_PRIORITY UINT j; UINT lowest_priority; -TX_THREAD *next_thread; +TX_THREAD *next_thread; ULONG test_cores; UINT core; UINT thread_mapped; @@ -143,8 +143,8 @@ UINT map_index; #ifndef TX_NO_TIMER TX_TIMER_INTERNAL *timer_ptr; TX_TIMER_INTERNAL **list_head; -TX_TIMER_INTERNAL *next_timer; -TX_TIMER_INTERNAL *previous_timer; +TX_TIMER_INTERNAL *next_timer; +TX_TIMER_INTERNAL *previous_timer; #endif @@ -164,7 +164,7 @@ TX_TIMER_INTERNAL *previous_timer; if ((thread_ptr -> tx_thread_timer.tx_timer_internal_list_head) != TX_NULL) { - /* Deactivate the thread's timeout timer. This is now done in-line + /* Deactivate the thread's timeout timer. This is now done in-line for ThreadX SMP so the additional protection logic can be avoided. */ /* Deactivate the timer. */ @@ -225,7 +225,7 @@ TX_TIMER_INTERNAL *previous_timer; } #endif -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(thread_ptr) @@ -249,11 +249,11 @@ TX_TIMER_INTERNAL *previous_timer; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(4, 0, thread_ptr); #endif - + #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) { @@ -270,7 +270,7 @@ TX_TIMER_INTERNAL *previous_timer; { /* 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) { @@ -281,7 +281,7 @@ TX_TIMER_INTERNAL *previous_timer; /* No, now check to see if the delayed suspension flag is set. */ if (thread_ptr -> tx_thread_delayed_suspend == TX_FALSE) - { + { /* Clear the suspending flag. */ thread_ptr -> tx_thread_suspending = TX_FALSE; @@ -297,7 +297,7 @@ TX_TIMER_INTERNAL *previous_timer; } 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; @@ -314,13 +314,13 @@ TX_TIMER_INTERNAL *previous_timer; } } } - else + else { /* Check to make sure the thread has not already been resumed. */ if (thread_ptr -> tx_thread_state != TX_READY) { - + /* Check for a delayed suspend flag. */ if (thread_ptr -> tx_thread_delayed_suspend == TX_TRUE) { @@ -369,7 +369,7 @@ TX_TIMER_INTERNAL *previous_timer; head_ptr -> tx_thread_ready_previous = thread_ptr; thread_ptr -> tx_thread_ready_previous = tail_ptr; thread_ptr -> tx_thread_ready_next = head_ptr; - } + } else { @@ -396,16 +396,16 @@ TX_TIMER_INTERNAL *previous_timer; /* Determine if a thread with preemption-threshold is currently scheduled. */ if (_tx_thread_preemption__threshold_scheduled != TX_NULL) { - + /* Yes, there has been a thread with preemption-threshold scheduled. */ - + /* Determine if this thread can run with the current preemption-threshold. */ if (priority >= _tx_thread_preemption__threshold_scheduled -> tx_thread_preempt_threshold) - { - - /* The thread cannot run because of the current preemption-threshold. Simply + { + + /* The thread cannot run because of the current preemption-threshold. Simply return at this point. */ - + #ifndef TX_NOT_INTERRUPTABLE /* Decrement the preemption disable flag. */ @@ -417,23 +417,23 @@ TX_TIMER_INTERNAL *previous_timer; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(5, 0, thread_ptr); #endif - + #ifndef TX_NOT_INTERRUPTABLE /* Restore interrupts. */ TX_RESTORE #endif - + /* Processing is complete, set the complete flag. */ processing_complete = TX_TRUE; } } - + /* Is the processing complete at this point? */ if (processing_complete == TX_FALSE) { - /* Determine if this newly ready thread has preemption-threshold set. If so, determine + /* Determine if this newly ready thread has preemption-threshold set. If so, determine if any other threads would need to be unscheduled for this thread to execute. */ if (thread_ptr -> tx_thread_preempt_threshold < priority) { @@ -445,26 +445,26 @@ TX_TIMER_INTERNAL *previous_timer; while(i < ((UINT) TX_THREAD_SMP_MAX_CORES)) #else while(i < _tx_thread_smp_max_cores) -#endif +#endif { - + /* Pickup the current execute thread for this core. */ execute_thread = _tx_thread_execute_ptr[i]; - + /* Is there a thread mapped to this core? */ if (execute_thread == TX_NULL) { - - /* Get out of the loop. */ + + /* Get out of the loop. */ loop_finished = TX_TRUE; } else { - + /* Determine if this thread should preempt the thread in the execution list. */ if (priority < execute_thread -> tx_thread_preempt_threshold) { - + /* Get out of the loop. */ loop_finished = TX_TRUE; } @@ -473,7 +473,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Determine if we need to get out of the loop. */ if (loop_finished == TX_TRUE) { - + /* Get out of the loop. */ break; } @@ -485,7 +485,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Determine if there is a reason to rebalance the list. */ #ifndef TX_THREAD_SMP_DYNAMIC_CORE_MAX if (i < ((UINT) TX_THREAD_SMP_MAX_CORES)) -#else +#else if (i < _tx_thread_smp_max_cores) #endif { @@ -496,7 +496,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Call the rebalance routine. This routine maps cores and ready threads. */ _tx_thread_smp_rebalance_execute_list(core_index); } - } + } #ifdef TX_THREAD_SMP_EQUAL_PRIORITY else { @@ -519,14 +519,14 @@ TX_TIMER_INTERNAL *previous_timer; /* Pickup the core this thread was previously executing on. */ i = thread_ptr -> tx_thread_smp_core_mapped; - + /* Pickup the currently executing thread for the previously mapped core. */ execute_thread = _tx_thread_execute_ptr[i]; /* First, let's see if the last core this thread executed on is available. */ if (execute_thread == TX_NULL) { - + /* Yes, simply place this thread into the execute list at the same location. */ _tx_thread_execute_ptr[i] = thread_ptr; @@ -538,28 +538,28 @@ TX_TIMER_INTERNAL *previous_timer; } else { - - /* This core is not able to execute on the core it last executed on + + /* This core is not able to execute on the core it last executed on because another thread is already scheduled on that core. */ /* Pickup the available cores for the newly ready thread. */ available_cores = thread_ptr -> tx_thread_smp_cores_allowed; - /* Isolate the lowest set bit so we can determine if more than one core is + /* Isolate the lowest set bit so we can determine if more than one core is available. */ available_cores = available_cores & ((~available_cores) + ((ULONG) 1)); /* Determine if either this thread or the currently schedule thread can - run on more than one core or on a different core and preemption is not + run on more than one core or on a different core and preemption is not possible. */ if ((available_cores == thread_ptr -> tx_thread_smp_cores_allowed) && - (available_cores == execute_thread -> tx_thread_smp_cores_allowed)) + (available_cores == execute_thread -> tx_thread_smp_cores_allowed)) { - - /* Both this thread and the execute thread can only execute on the same core, - so this thread can only be scheduled if its priority is less. Otherwise, + + /* Both this thread and the execute thread can only execute on the same core, + so this thread can only be scheduled if its priority is less. Otherwise, there is nothing else to examine. */ - if (thread_ptr -> tx_thread_priority < execute_thread -> tx_thread_priority) + if (thread_ptr -> tx_thread_priority < execute_thread -> tx_thread_priority) { /* We know that we have to preempt the executing thread. */ @@ -567,19 +567,19 @@ TX_TIMER_INTERNAL *previous_timer; /* Preempt the executing thread. */ _tx_thread_execute_ptr[i] = thread_ptr; - /* If necessary, interrupt the core with the new thread to schedule. */ + /* If necessary, interrupt the core with the new thread to schedule. */ _tx_thread_smp_core_interrupt(thread_ptr, core_index, i); /* If necessary, wakeup the core. */ _tx_thread_smp_core_wakeup(core_index, i); } } - else + else { - + /* Determine if there are any available cores to execute on. */ available_cores = _tx_thread_smp_available_cores_get(); - + /* Determine what the possible cores are for this thread. */ thread_possible_cores = thread_ptr -> tx_thread_smp_cores_allowed; @@ -589,7 +589,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Determine if there are available cores. */ if (available_cores != ((ULONG) 0)) { - + /* Determine if one of the available cores is allowed for this thread. */ if ((available_cores & thread_possible_cores) != ((ULONG) 0)) { @@ -597,7 +597,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Calculate the lowest set bit of allowed cores. */ test_cores = (thread_possible_cores & available_cores); TX_LOWEST_SET_BIT_CALCULATE(test_cores, i) - + /* Remember this index in the thread control block. */ thread_ptr -> tx_thread_smp_core_mapped = i; @@ -612,38 +612,38 @@ TX_TIMER_INTERNAL *previous_timer; } else { - + /* There are available cores, however, they are all excluded. */ - + /* Calculate the possible cores from the cores currently scheduled. */ possible_cores = _tx_thread_smp_possible_cores_get(); - + /* Determine if it is worthwhile to try to remap the execution list. */ if ((available_cores & possible_cores) != ((ULONG) 0)) { - + /* Yes, some of the currently scheduled threads can be moved. */ - + /* Now determine if there could be a remap solution that will allow us to schedule this thread. */ - + /* Narrow to the current possible cores. */ thread_possible_cores = thread_possible_cores & possible_cores; - - /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room + + /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room for this thread. */ /* Default the schedule list to the current execution list. */ _tx_thread_smp_schedule_list_setup(); - + /* Determine the possible core mapping. */ test_possible_cores = possible_cores & ~(thread_possible_cores); - + /* Attempt to remap the cores in order to schedule this thread. */ - core = _tx_thread_smp_remap_solution_find(thread_ptr, available_cores, thread_possible_cores, test_possible_cores); + core = _tx_thread_smp_remap_solution_find(thread_ptr, available_cores, thread_possible_cores, test_possible_cores); /* Determine if remapping was successful. */ - if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) - { + if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) + { /* Clear the execute list. */ _tx_thread_smp_execute_list_clear(); @@ -657,33 +657,33 @@ TX_TIMER_INTERNAL *previous_timer; } } } - + /* Determine if we need to investigate thread preemption. */ if (thread_mapped == TX_FALSE) { /* At this point, we need to first check for thread preemption possibilities. */ lowest_priority = _tx_thread_smp_lowest_priority_get(); - + /* Does this thread have a higher priority? */ if (thread_ptr -> tx_thread_priority < lowest_priority) { - + /* Yes, preemption is possible. */ - + /* Pickup the thread to preempt. */ preempt_thread = _tx_thread_priority_list[lowest_priority]; - + /* Determine if there are more than one thread ready at this priority level. */ if (preempt_thread -> tx_thread_ready_next != preempt_thread) { - + /* Remember the list head. */ head_ptr = preempt_thread; - + /* Setup thread search pointer to the start of the list. */ next_thread = preempt_thread -> tx_thread_ready_next; - + /* Loop to find the last thread scheduled at this priority. */ i = ((UINT) 0); #ifndef TX_THREAD_SMP_DYNAMIC_CORE_MAX @@ -691,43 +691,43 @@ TX_TIMER_INTERNAL *previous_timer; #else while (i < _tx_thread_smp_max_cores) -#endif +#endif { - + /* Is this thread currently scheduled? */ if (next_thread == _tx_thread_execute_ptr[next_thread -> tx_thread_smp_core_mapped]) { - + /* Yes, this is the new preempt thread. */ preempt_thread = next_thread; - + /* Increment core count. */ i++; } - + /* Move to the next thread. */ next_thread = next_thread -> tx_thread_ready_next; /* Are we at the head of the list? */ if (next_thread == head_ptr) { - + /* End the loop. */ i = ((UINT) TX_THREAD_SMP_MAX_CORES); } - } + } } - + /* Calculate the core that this thread is scheduled on. */ possible_cores = (((ULONG) 1) << preempt_thread -> tx_thread_smp_core_mapped); - + /* Determine if preemption is possible. */ if ((thread_possible_cores & possible_cores) != ((ULONG) 0)) { - + /* Pickup the newly available core. */ i = preempt_thread -> tx_thread_smp_core_mapped; - + /* Remember this index in the thread control block. */ thread_ptr -> tx_thread_smp_core_mapped = i; @@ -745,7 +745,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Build the list of possible thread preemptions, ordered lowest priority first. */ possible_cores = _tx_thread_smp_preemptable_threads_get(thread_ptr -> tx_thread_priority, possible_preemption_list); - + /* Determine if preemption is possible. */ /* Loop through the potential threads can can be preempted. */ @@ -753,7 +753,7 @@ TX_TIMER_INTERNAL *previous_timer; loop_finished = TX_FALSE; while (possible_preemption_list[i] != TX_NULL) { - + /* Pickup the thread to preempt. */ preempt_thread = possible_preemption_list[i]; @@ -762,17 +762,17 @@ TX_TIMER_INTERNAL *previous_timer; /* Calculate the core that this thread is scheduled on. */ available_cores = (((ULONG) 1) << j); - + /* Can this thread execute on this core? */ if ((thread_possible_cores & available_cores) != ((ULONG) 0)) { - + /* Remember this index in the thread control block. */ thread_ptr -> tx_thread_smp_core_mapped = j; /* Map this thread to the free slot. */ _tx_thread_execute_ptr[j] = thread_ptr; - + /* If necessary, interrupt the core with the new thread to schedule. */ _tx_thread_smp_core_interrupt(thread_ptr, core_index, j); @@ -785,13 +785,13 @@ TX_TIMER_INTERNAL *previous_timer; else { - /* No, the thread to preempt is not running on a core available to the new thread. + /* No, the thread to preempt is not running on a core available to the new thread. Attempt to find a remapping solution. */ /* Narrow to the current possible cores. */ thread_possible_cores = thread_possible_cores & possible_cores; - - /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room + + /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room for this thread. */ /* Temporarily set the execute thread to NULL. */ @@ -799,29 +799,29 @@ TX_TIMER_INTERNAL *previous_timer; /* Default the schedule list to the current execution list. */ _tx_thread_smp_schedule_list_setup(); - + /* Determine the possible core mapping. */ test_possible_cores = possible_cores & ~(thread_possible_cores); /* Attempt to remap the cores in order to schedule this thread. */ - core = _tx_thread_smp_remap_solution_find(thread_ptr, available_cores, thread_possible_cores, test_possible_cores); + core = _tx_thread_smp_remap_solution_find(thread_ptr, available_cores, thread_possible_cores, test_possible_cores); /* Determine if remapping was successful. */ if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) - { + { /* Clear the execute list. */ _tx_thread_smp_execute_list_clear(); - + /* Setup the execute list based on the updated schedule list. */ _tx_thread_smp_execute_list_setup(core_index); - + /* Finished with the preemption condition. */ loop_finished = TX_TRUE; } else { - + /* Restore the preempted thread and examine the next thread. */ _tx_thread_execute_ptr[j] = preempt_thread; } @@ -830,27 +830,27 @@ TX_TIMER_INTERNAL *previous_timer; /* Determine if we should get out of the loop. */ if (loop_finished == TX_TRUE) { - + /* Yes, get out of the loop. */ break; } - + /* Move to the next possible thread preemption. */ i++; } } } } - } + } } } } #endif } } - } + } } - + /* Determine if there is more processing. */ if (processing_complete == TX_FALSE) { @@ -860,7 +860,7 @@ TX_TIMER_INTERNAL *previous_timer; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(5, 0, thread_ptr); #endif - + #ifdef TX_ENABLE_EVENT_TRACE /* Check that the event time stamp is unchanged. A different @@ -874,7 +874,7 @@ TX_TIMER_INTERNAL *previous_timer; #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]); #else - entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]); + entry_ptr -> tx_trace_buffer_entry_information_field_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]); #endif } #endif @@ -885,11 +885,11 @@ TX_TIMER_INTERNAL *previous_timer; _tx_thread_preempt_disable--; #endif - if (_tx_thread_current_ptr[core_index] != _tx_thread_execute_ptr[core_index]) + if (_tx_thread_current_ptr[core_index] != _tx_thread_execute_ptr[core_index]) { -#ifdef TX_ENABLE_STACK_CHECKING - +#ifdef TX_ENABLE_STACK_CHECKING + /* Pickup the next thread to execute. */ thread_ptr = _tx_thread_execute_ptr[core_index]; @@ -906,8 +906,8 @@ TX_TIMER_INTERNAL *previous_timer; not the same as the execute thread pointer AND the system state and preempt disable flags are clear. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { - - /* Is the preempt disable flag set? */ + + /* Is the preempt disable flag set? */ if (_tx_thread_preempt_disable == ((UINT) 0)) { @@ -922,14 +922,14 @@ TX_TIMER_INTERNAL *previous_timer; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif /* Preemption is needed - return to the system! */ _tx_thread_system_return(); - + #ifdef TX_NOT_INTERRUPTABLE /* Setup protection again since caller is expecting that it is still in force. */ diff --git a/common_smp/src/tx_thread_system_suspend.c b/common_smp/src/tx_thread_system_suspend.c index 5707ecca..8838d98e 100644 --- a/common_smp/src/tx_thread_system_suspend.c +++ b/common_smp/src/tx_thread_system_suspend.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -33,58 +33,58 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_system_suspend PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_system_suspend PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function suspends the specified thread and changes the thread */ -/* state to the value specified. Note: delayed suspension processing */ +/* */ +/* This function suspends the specified thread and changes the thread */ +/* state to the value specified. Note: delayed suspension processing */ /* is handled outside of this routine. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_available_cores_get Get available cores bitmap */ -/* _tx_thread_smp_core_preempt Preempt core for new thread */ -/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ -/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ -/* _tx_thread_smp_next_priority_find Find next priority with one */ -/* or more ready threads */ -/* _tx_thread_smp_possible_cores_get Get possible cores bitmap */ -/* [_tx_thread_smp_protect] Get protection */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ -/* schedule another thread */ -/* _tx_thread_smp_schedule_list_setup Inherit schedule list from */ -/* execute list */ -/* _tx_thread_system_return Return to system */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_priority_change Thread priority change */ -/* _tx_thread_shell_entry Thread shell function */ -/* _tx_thread_sleep Thread sleep */ -/* _tx_thread_suspend Application thread suspend */ -/* _tx_thread_terminate Thread terminate */ -/* Other ThreadX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_available_cores_get Get available cores bitmap */ +/* _tx_thread_smp_core_preempt Preempt core for new thread */ +/* _tx_thread_smp_execute_list_clear Clear the thread execute list */ +/* _tx_thread_smp_execute_list_setup Setup the thread execute list */ +/* _tx_thread_smp_next_priority_find Find next priority with one */ +/* or more ready threads */ +/* _tx_thread_smp_possible_cores_get Get possible cores bitmap */ +/* [_tx_thread_smp_protect] Get protection */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* _tx_thread_smp_remap_solution_find Attempt to remap threads to */ +/* schedule another thread */ +/* _tx_thread_smp_schedule_list_setup Inherit schedule list from */ +/* execute list */ +/* _tx_thread_system_return Return to system */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_priority_change Thread priority change */ +/* _tx_thread_shell_entry Thread shell function */ +/* _tx_thread_sleep Thread sleep */ +/* _tx_thread_suspend Application thread suspend */ +/* _tx_thread_terminate Thread terminate */ +/* Other ThreadX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -97,15 +97,15 @@ VOID _tx_thread_system_suspend(TX_THREAD *thread_ptr) TX_INTERRUPT_SAVE_AREA #endif - -UINT priority; + +UINT priority; UINT i; -ULONG priority_bit; +ULONG priority_bit; ULONG combined_flags; -ULONG priority_map; +ULONG priority_map; UINT core_index; #ifndef TX_THREAD_SMP_EQUAL_PRIORITY -ULONG complex_path_possible; +ULONG complex_path_possible; UINT core; ULONG possible_cores; ULONG thread_possible_cores; @@ -159,7 +159,7 @@ UINT processing_complete; /* Debug entry. */ _tx_thread_smp_debug_entry_insert(6, 1, thread_ptr); #endif - + #ifndef TX_NO_TIMER /* Determine if a timeout needs to be activated. */ @@ -180,14 +180,14 @@ UINT processing_complete; if (timeout != TX_WAIT_FOREVER) { - /* Activate the thread timer with the timeout value setup in the caller. This is now done in-line + /* Activate the thread timer with the timeout value setup in the caller. This is now done in-line for ThreadX SMP so the additional protection logic can be avoided. */ /* Activate the thread's timeout timer. */ /* Setup pointer to internal timer. */ timer_ptr = &(thread_ptr -> tx_thread_timer); - + /* Calculate the amount of time remaining for the timer. */ if (timeout > TX_TIMER_ENTRIES) { @@ -206,7 +206,7 @@ UINT processing_complete; /* 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)) @@ -220,7 +220,7 @@ UINT processing_complete; /* 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. */ @@ -229,7 +229,7 @@ UINT processing_complete; /* Setup the list head pointer. */ *timer_list = timer_ptr; - } + } else { @@ -250,7 +250,7 @@ UINT processing_complete; #endif -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(thread_ptr) @@ -296,7 +296,7 @@ UINT processing_complete; TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_SUSPEND, thread_ptr, thread_ptr -> tx_thread_state, TX_POINTER_TO_ULONG_CONVERT(&priority), TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]), TX_TRACE_INTERNAL_EVENTS) /* 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) { @@ -319,15 +319,15 @@ UINT processing_complete; /* Calculate the index into the bit map array. */ map_index = priority/((UINT) 32); #endif - + /* Determine if this thread has preemption-threshold set. */ - if (thread_ptr -> tx_thread_preempt_threshold < priority) + if (thread_ptr -> tx_thread_preempt_threshold < priority) { /* Was this thread with preemption-threshold set actually preempted with preemption-threshold set? */ if (_tx_thread_preemption_threshold_list[priority] == thread_ptr) { - + /* Clear the preempted list entry. */ _tx_thread_preemption_threshold_list[priority] = TX_NULL; @@ -353,10 +353,10 @@ UINT processing_complete; /* Determine if this thread has global preemption disabled. */ if (thread_ptr == _tx_thread_preemption__threshold_scheduled) { - + /* Clear the global preemption disable flag. */ _tx_thread_preemption__threshold_scheduled = TX_NULL; - + #ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* Clear the entry in the preempted list. */ @@ -367,7 +367,7 @@ UINT processing_complete; if (_tx_thread_preempted_map_active != ((ULONG) 0)) #else if (_tx_thread_preempted_maps[0] != ((ULONG) 0)) -#endif +#endif { #if TX_MAX_PRIORITIES > 32 @@ -395,11 +395,11 @@ UINT processing_complete; priority_bit = (ULONG) priority_bit_set; /* Setup the highest priority preempted thread. */ - next_preempted = base_priority + priority_bit; + next_preempted = base_priority + priority_bit; /* Pickup the next preempted thread. */ preempted_thread = _tx_thread_preemption_threshold_list[next_preempted]; - + /* Setup the preempted thread. */ _tx_thread_preemption__threshold_scheduled = preempted_thread; } @@ -431,7 +431,7 @@ UINT processing_complete; _tx_thread_priority_list[priority] = thread_ptr -> tx_thread_ready_next; #ifndef TX_THREAD_SMP_EQUAL_PRIORITY - + /* Update the next pointer as well. */ next_thread = thread_ptr -> tx_thread_ready_next; #endif @@ -446,7 +446,7 @@ UINT processing_complete; next_thread = thread_ptr; #endif - /* 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; @@ -477,7 +477,7 @@ UINT processing_complete; /* Calculate the index to find the next highest priority thread ready for execution. */ priority_map = _tx_thread_priority_map_active; - + /* Determine if there is anything. */ if (priority_map != ((ULONG) 0)) { @@ -504,7 +504,7 @@ UINT processing_complete; /* 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 +#ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = ((ULONG) 0); #else entry_ptr -> tx_trace_buffer_entry_information_field_4 = ((ULONG) 0); @@ -543,22 +543,22 @@ UINT processing_complete; TX_THREAD_SMP_WAKEUP(i); } #endif - + #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(7, 1, thread_ptr); #endif - + #ifdef TX_ENABLE_EVENT_TRACE - + /* Check that the event time stamp is unchanged. A different timestamp means that a later event wrote over the system suspend event. In that case, do nothing here. */ if ((entry_ptr != TX_NULL) && (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)) { - /* Timestamp is the same, set the "next thread pointer" to the next thread scheduled + /* Timestamp is the same, set the "next thread pointer" to the next thread scheduled for this core. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]); @@ -586,7 +586,7 @@ UINT processing_complete; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif @@ -613,7 +613,7 @@ UINT processing_complete; i = thread_ptr -> tx_thread_smp_core_mapped; if (_tx_thread_execute_ptr[i] == thread_ptr) { - + /* Clear the entry in the thread execution list. */ _tx_thread_execute_ptr[i] = TX_NULL; @@ -621,14 +621,14 @@ UINT processing_complete; thread. */ if ((_tx_thread_preemption__threshold_scheduled != TX_NULL) || (thread_ptr -> tx_thread_preempt_threshold < thread_ptr -> tx_thread_priority)) { - + /* Call the rebalance routine. This routine maps cores and ready threads. */ _tx_thread_smp_rebalance_execute_list(core_index); } #ifdef TX_THREAD_SMP_EQUAL_PRIORITY else { - + /* For equal priority SMP, we simply use the rebalance list function. */ /* Call the rebalance routine. This routine maps cores and ready threads. */ @@ -650,7 +650,7 @@ UINT processing_complete; /* No more threads at this priority level. */ - /* Start at the priority after that of the thread suspending, since we know there are no + /* Start at the priority after that of the thread suspending, since we know there are no other threads at the suspending thread's priority ready to execute. */ next_priority++; @@ -663,7 +663,7 @@ UINT processing_complete; /* Setup the available cores bit map. In the suspend case, this is simply the core that is now available. */ available_cores = (((ULONG) 1) << i); - + /* Calculate the possible complex path. */ complex_path_possible = possible_cores & available_cores; @@ -682,13 +682,13 @@ UINT processing_complete; /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; } else { - + /* Pickup the next thread to schedule. */ next_thread = _tx_thread_priority_list[next_priority]; } @@ -697,30 +697,30 @@ UINT processing_complete; /* Determine if the processing is not complete. */ if (loop_finished == TX_FALSE) { - + /* Is the this thread already in the execute list? */ if (next_thread != _tx_thread_execute_ptr[next_thread -> tx_thread_smp_core_mapped]) { - + /* No, not already on the execute list. */ - + /* Check to see if the thread has preemption-threshold set. */ if (next_thread -> tx_thread_preempt_threshold != next_thread -> tx_thread_priority) { - + /* Call the rebalance routine. This routine maps cores and ready threads. */ _tx_thread_smp_rebalance_execute_list(core_index); - + /* Get out of the loop. */ - loop_finished = TX_TRUE; + loop_finished = TX_TRUE; } else { - + /* Now determine if this thread is allowed to run on this core. */ if ((((next_thread -> tx_thread_smp_cores_allowed >> i) & ((ULONG) 1))) != ((ULONG) 0)) { - + /* Remember this index in the thread control block. */ next_thread -> tx_thread_smp_core_mapped = i; @@ -730,42 +730,42 @@ UINT processing_complete; /* Found the thread to execute. */ loop_finished = TX_TRUE; } - else + else { /* Determine if nontrivial scheduling is possible. */ if (complex_path_possible != ((ULONG) 0)) { - - /* Check for nontrivial scheduling, i.e., can other threads be remapped to allow this thread to be + + /* Check for nontrivial scheduling, i.e., can other threads be remapped to allow this thread to be scheduled. */ /* Determine what the possible cores are for this thread. */ thread_possible_cores = next_thread -> tx_thread_smp_cores_allowed; - + /* Apply the current possible cores. */ thread_possible_cores = thread_possible_cores & possible_cores; if (thread_possible_cores != ((ULONG) 0)) { - /* Note that we know that the thread must have the target core excluded at this point, + /* Note that we know that the thread must have the target core excluded at this point, since we failed the test above. */ - - /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room + + /* Now we need to see if one of the other threads in the non-excluded cores can be moved to make room for this thread. */ /* Default the schedule list to the current execution list. */ _tx_thread_smp_schedule_list_setup(); - + /* Determine the possible core mapping. */ test_possible_cores = possible_cores & ~(thread_possible_cores); /* Attempt to remap the cores in order to schedule this thread. */ - core = _tx_thread_smp_remap_solution_find(next_thread, available_cores, thread_possible_cores, test_possible_cores); - + core = _tx_thread_smp_remap_solution_find(next_thread, available_cores, thread_possible_cores, test_possible_cores); + /* Determine if remapping was successful. */ - if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) - { + if (core != ((UINT) TX_THREAD_SMP_MAX_CORES)) + { /* Clear the execute list. */ _tx_thread_smp_execute_list_clear(); @@ -779,7 +779,7 @@ UINT processing_complete; else { - /* We couldn't assign the thread to any of the cores possible for the thread so update the possible cores for the + /* We couldn't assign the thread to any of the cores possible for the thread so update the possible cores for the next pass so we don't waste time looking at them again! */ possible_cores = possible_cores & (~thread_possible_cores); } @@ -796,24 +796,24 @@ UINT processing_complete; /* Move to the next thread. */ next_thread = next_thread -> tx_thread_ready_next; - + /* Determine if we are at the head of the list. */ if (next_thread == _tx_thread_priority_list[next_priority]) { - + /* Yes, set the next thread pointer to NULL, increment the priority, and continue. */ next_thread = TX_NULL; next_priority++; - + /* Determine if there are no more threads to execute. */ if (next_priority == ((UINT) TX_MAX_PRIORITIES)) { - + /* Break out of loop. */ loop_finished = TX_TRUE; } } - } + } } while (loop_finished == TX_FALSE); #ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT @@ -825,7 +825,7 @@ UINT processing_complete; /* Make sure thread execution has started. */ if (_tx_thread_system_state[i] < ((ULONG) TX_INITIALIZE_IN_PROGRESS)) { - + /* Preempt the mapped thread. */ _tx_thread_smp_core_preempt(i); } @@ -835,7 +835,7 @@ UINT processing_complete; #ifdef TX_THREAD_SMP_WAKEUP_LOGIC /* Does this need to be waked up? */ - if (i != core_index) + if (i != core_index) { /* Check to make sure there a thread to execute for this core. */ @@ -847,7 +847,7 @@ UINT processing_complete; } } #endif - } + } #endif } } @@ -860,13 +860,13 @@ UINT processing_complete; /* Check to see if the processing is complete. */ if (processing_complete == TX_FALSE) { - + #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(7, 1, thread_ptr); #endif - + #ifdef TX_ENABLE_EVENT_TRACE /* Check that the event time stamp is unchanged. A different @@ -875,7 +875,7 @@ UINT processing_complete; if ((entry_ptr != TX_NULL) && (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)) { - /* Timestamp is the same, set the "next thread pointer" to the next thread scheduled + /* Timestamp is the same, set the "next thread pointer" to the next thread scheduled for this core. */ #ifdef TX_MISRA_ENABLE entry_ptr -> tx_trace_buffer_entry_info_4 = TX_POINTER_TO_ULONG_CONVERT(_tx_thread_execute_ptr[core_index]); @@ -886,10 +886,10 @@ UINT processing_complete; #endif /* Determine if a preemption condition is present. */ - if (_tx_thread_current_ptr[core_index] != _tx_thread_execute_ptr[core_index]) + if (_tx_thread_current_ptr[core_index] != _tx_thread_execute_ptr[core_index]) { -#ifdef TX_ENABLE_STACK_CHECKING +#ifdef TX_ENABLE_STACK_CHECKING /* Pickup the next execute pointer. */ thread_ptr = _tx_thread_execute_ptr[core_index]; @@ -907,7 +907,7 @@ UINT processing_complete; not the same as the execute thread pointer AND the system state and preempt disable flags are clear. */ if (_tx_thread_system_state[core_index] == ((ULONG) 0)) { - + /* Check the preempt disable flag. */ if (_tx_thread_preempt_disable == ((UINT) 0)) { @@ -934,7 +934,7 @@ UINT processing_complete; /* Increment the preempt disable flag in order to keep the protection. */ _tx_thread_preempt_disable++; - + /* Restore interrupts. */ TX_RESTORE #endif @@ -962,7 +962,7 @@ UINT processing_complete; /* Determine if processing is complete. If so, no need to restore interrupts. */ if (processing_complete == TX_FALSE) { - + /* Restore interrupts. */ TX_RESTORE } diff --git a/common_smp/src/tx_thread_terminate.c b/common_smp/src/tx_thread_terminate.c index 9badb490..f84a4994 100644 --- a/common_smp/src/tx_thread_terminate.c +++ b/common_smp/src/tx_thread_terminate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -31,48 +31,50 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_terminate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_terminate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function handles application thread terminate requests. Once */ -/* a thread is terminated, it cannot be executed again unless it is */ -/* deleted and recreated. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* status Return completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_system_deactivate Timer deactivate function */ -/* _tx_thread_system_suspend Actual thread suspension */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend */ -/* thread */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* Suspend Cleanup Routine Suspension cleanup function */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function handles application thread terminate requests. Once */ +/* a thread is terminated, it cannot be executed again unless it is */ +/* deleted and recreated. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* status Return completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_system_deactivate Timer deactivate function */ +/* _tx_thread_system_suspend Actual thread suspension */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend */ +/* thread */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* Suspend Cleanup Routine Suspension cleanup function */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_terminate(TX_THREAD *thread_ptr) @@ -111,7 +113,7 @@ ULONG suspension_sequence; TX_RESTORE /* Return success since thread is already terminated. */ - status = TX_SUCCESS; + status = TX_SUCCESS; } /* Check the specified thread's current status. */ @@ -199,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; @@ -277,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); } @@ -285,7 +287,7 @@ ULONG suspension_sequence; #ifndef TX_NOT_INTERRUPTABLE /* Disable interrupts. */ - TX_DISABLE + TX_DISABLE #endif /* Enable preemption. */ diff --git a/common_smp/src/tx_thread_time_slice.c b/common_smp/src/tx_thread_time_slice.c index fae9102a..e700b26d 100644 --- a/common_smp/src/tx_thread_time_slice.c +++ b/common_smp/src/tx_thread_time_slice.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,41 +32,41 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_time_slice PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_time_slice PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function moves the currently executing thread to the end of */ -/* the threads ready at the same priority level as a result of a */ -/* time-slice interrupt. If no other thread of the same priority is */ -/* ready, this function simply returns. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_timer_interrupt Timer interrupt handling */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function moves the currently executing thread to the end of */ +/* the threads ready at the same priority level as a result of a */ +/* time-slice interrupt. If no other thread of the same priority is */ +/* ready, this function simply returns. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_smp_rebalance_execute_list Rebalance the execution list */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_timer_interrupt Timer interrupt handling */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -103,11 +103,11 @@ UINT preempt_disable; #if TX_THREAD_SMP_MAX_CORES == 3 if ((_tx_timer_time_slice[0] != ((ULONG) 0)) || (_tx_timer_time_slice[1] != ((ULONG) 0)) || (_tx_timer_time_slice[2] != ((ULONG) 0))) { -#endif +#endif #if TX_THREAD_SMP_MAX_CORES == 4 if ((_tx_timer_time_slice[0] != ((ULONG) 0)) || (_tx_timer_time_slice[1] != ((ULONG) 0)) || (_tx_timer_time_slice[2] != ((ULONG) 0)) || (_tx_timer_time_slice[3] != ((ULONG) 0))) { -#endif +#endif /* Initialize the rebalance flag to false. */ rebalance = TX_FALSE; @@ -129,7 +129,7 @@ UINT preempt_disable; /* Determine if there is a time-slice active on this core. */ if (_tx_timer_time_slice[core_index] != ((ULONG) 0)) { - + /* Time-slice is active, decrement it for this core. */ _tx_timer_time_slice[core_index]--; @@ -153,14 +153,14 @@ UINT preempt_disable; /* Reset the actual time-slice variable. */ _tx_timer_time_slice[core_index] = thread_ptr -> tx_thread_time_slice; - + #ifdef TX_THREAD_SMP_DEBUG_ENABLE /* Debug entry. */ _tx_thread_smp_debug_entry_insert(10, 0, thread_ptr); #endif - -#ifdef TX_ENABLE_STACK_CHECKING + +#ifdef TX_ENABLE_STACK_CHECKING /* Check this thread's stack. */ TX_THREAD_STACK_CHECK(thread_ptr) @@ -181,9 +181,9 @@ UINT preempt_disable; /* Determine if preemption-threshold is set. If so, don't time-slice. */ if (priority == thread_ptr -> tx_thread_preempt_threshold) { - + /* Preemption-threshold is not set. */ - + /* Pickup the next thread. */ next_thread = thread_ptr -> tx_thread_ready_next; @@ -202,7 +202,7 @@ UINT preempt_disable; /* Determine if this thread is at the head of the list. */ if (head_ptr == thread_ptr) { - + /* Simply move the head pointer to put this thread at the end of the ready list at this priority. */ _tx_thread_priority_list[priority] = next_thread; } @@ -229,12 +229,12 @@ UINT preempt_disable; preempted it either from another ISR or from the timer processing. */ if (_tx_thread_execute_ptr[core_index] != thread_ptr) { - + /* Set the rebalance flag. */ rebalance = TX_TRUE; - } - - /* Determine if the rebalance flag has been set already. If so, don't bother trying to update the + } + + /* Determine if the rebalance flag has been set already. If so, don't bother trying to update the execute list from this routine. */ if (rebalance == TX_FALSE) { @@ -248,35 +248,35 @@ UINT preempt_disable; /* Isolate the exclusion for this core. */ excluded = (next_thread -> tx_thread_smp_cores_excluded >> core_index) & ((ULONG) 1); - + /* Determine if the next thread has preemption-threshold set. */ if (next_thread -> tx_thread_preempt_threshold < next_thread -> tx_thread_priority) { - + /* Set the rebalance flag. */ rebalance = TX_TRUE; /* Get out of the loop. */ loop_finished = TX_TRUE; } - + /* Determine if the next thread is excluded from running on this core. */ else if (excluded == ((ULONG) 1)) { - + /* Set the rebalance flag. */ rebalance = TX_TRUE; - + /* Get out of the loop. */ loop_finished = TX_TRUE; } else { - + /* Is the next thread not scheduled */ if (next_thread != _tx_thread_execute_ptr[next_thread -> tx_thread_smp_core_mapped]) { - + /* Remember this index in the thread control block. */ next_thread -> tx_thread_smp_core_mapped = core_index; @@ -295,20 +295,20 @@ UINT preempt_disable; #endif /* Get out of the loop. */ loop_finished = TX_TRUE; - } + } } /* Is the loop fininshed? */ if (loop_finished == TX_TRUE) { - + /* Yes, break out of the loop. */ break; } - + /* Move to the next thread at this priority. */ next_thread = next_thread -> tx_thread_ready_next; - + } while (next_thread != thread_ptr); } } @@ -337,11 +337,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[0], system_state, preempt_disable, TX_POINTER_TO_ULONG_CONVERT(&thread_ptr), TX_TRACE_INTERNAL_EVENTS) #endif - + #if TX_THREAD_SMP_MAX_CORES == 1 } #endif @@ -350,9 +350,9 @@ UINT preempt_disable; #endif #if TX_THREAD_SMP_MAX_CORES == 3 } -#endif +#endif #if TX_THREAD_SMP_MAX_CORES == 4 } -#endif +#endif } diff --git a/common_smp/src/tx_thread_time_slice_change.c b/common_smp/src/tx_thread_time_slice_change.c index 2f7cd59a..74f18f16 100644 --- a/common_smp/src/tx_thread_time_slice_change.c +++ b/common_smp/src/tx_thread_time_slice_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -32,43 +32,43 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_time_slice_change PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_time_slice_change PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes thread time slice change requests. The */ -/* previous time slice is returned to the caller. If the new request */ -/* is made for an executing thread, it is also placed in the actual */ -/* time-slice countdown variable. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* new_time_slice New time slice */ -/* old_time_slice Old time slice */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes thread time slice change requests. The */ +/* previous time slice is returned to the caller. If the new request */ +/* is made for an executing thread, it is also placed in the actual */ +/* time-slice countdown variable. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* new_time_slice New time slice */ +/* old_time_slice Old time slice */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ diff --git a/common_smp/src/tx_thread_timeout.c b/common_smp/src/tx_thread_timeout.c index 3e1ce704..c0384d5d 100644 --- a/common_smp/src/tx_thread_timeout.c +++ b/common_smp/src/tx_thread_timeout.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -27,50 +27,53 @@ #include "tx_api.h" #include "tx_thread.h" +#include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_timeout PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_timeout PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function handles thread timeout processing. Timeouts occur in */ -/* two flavors, namely the thread sleep timeout and all other service */ -/* call timeouts. Thread sleep timeouts are processed locally, while */ -/* the others are processed by the appropriate suspension clean-up */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* timeout_input Contains the thread pointer */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* Suspension Cleanup Functions */ -/* _tx_thread_system_resume Resume thread */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_timer_expiration_process Timer expiration function */ -/* _tx_timer_thread_entry Timer thread function */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function handles thread timeout processing. Timeouts occur in */ +/* two flavors, namely the thread sleep timeout and all other service */ +/* call timeouts. Thread sleep timeouts are processed locally, while */ +/* the others are processed by the appropriate suspension clean-up */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* timeout_input Contains the thread pointer */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* Suspension Cleanup Functions */ +/* _tx_thread_system_resume Resume thread */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_timer_expiration_process Timer expiration function */ +/* _tx_timer_thread_entry Timer thread function */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_thread_timeout(ULONG timeout_input) @@ -78,7 +81,7 @@ VOID _tx_thread_timeout(ULONG timeout_input) TX_INTERRUPT_SAVE_AREA -TX_THREAD *thread_ptr; +TX_THREAD *thread_ptr; VOID (*suspend_cleanup)(struct TX_THREAD_STRUCT *suspend_thread_ptr, ULONG suspension_sequence); ULONG suspension_sequence; @@ -125,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; diff --git a/common_smp/src/tx_thread_wait_abort.c b/common_smp/src/tx_thread_wait_abort.c index e16b51c8..e5fbffae 100644 --- a/common_smp/src/tx_thread_wait_abort.c +++ b/common_smp/src/tx_thread_wait_abort.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,45 +30,47 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_thread_wait_abort PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_thread_wait_abort PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function aborts the wait condition that the specified thread */ -/* is in - regardless of what object the thread is waiting on - and */ -/* returns a TX_WAIT_ABORTED status to the specified thread. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Thread to abort the wait on */ -/* */ -/* OUTPUT */ -/* */ -/* status Return completion status */ -/* */ -/* CALLS */ -/* */ -/* Suspension Cleanup Functions */ -/* _tx_thread_system_resume */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function aborts the wait condition that the specified thread */ +/* is in - regardless of what object the thread is waiting on - and */ +/* returns a TX_WAIT_ABORTED status to the specified thread. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Thread to abort the wait on */ +/* */ +/* OUTPUT */ +/* */ +/* status Return completion status */ +/* */ +/* CALLS */ +/* */ +/* Suspension Cleanup Functions */ +/* _tx_thread_system_resume */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_thread_wait_abort(TX_THREAD *thread_ptr) @@ -93,17 +95,17 @@ 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; - } + } else { @@ -134,7 +136,7 @@ ULONG suspension_sequence; { /* Process all other suspension timeouts. */ - + /* Set the state to suspended. */ thread_ptr -> tx_thread_state = TX_SUSPENDED; @@ -211,11 +213,11 @@ ULONG suspension_sequence; /* Restore interrupts. */ TX_RESTORE -#else +#else /* Disable interrupts. */ TX_DISABLE - + /* Decrement the disable preemption flag. */ _tx_thread_preempt_disable--; @@ -223,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_smp/src/tx_time_get.c b/common_smp/src/tx_time_get.c index 80cde187..3c366559 100644 --- a/common_smp/src/tx_time_get.c +++ b/common_smp/src/tx_time_get.c @@ -65,7 +65,9 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 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 */ /* */ diff --git a/common_smp/src/tx_time_set.c b/common_smp/src/tx_time_set.c index 8dc392ed..13856cef 100644 --- a/common_smp/src/tx_time_set.c +++ b/common_smp/src/tx_time_set.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,42 +30,44 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_time_set PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_time_set PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function modifies the internal, free-running, system clock */ -/* as specified by the caller. */ -/* */ -/* INPUT */ -/* */ -/* new_time New time value */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function modifies the internal, free-running, system clock */ +/* as specified by the caller. */ +/* */ +/* INPUT */ +/* */ +/* new_time New time value */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_time_set(ULONG new_time) diff --git a/common_smp/src/tx_timer_activate.c b/common_smp/src/tx_timer_activate.c index 2c97cbbb..8a9ef71c 100644 --- a/common_smp/src/tx_timer_activate.c +++ b/common_smp/src/tx_timer_activate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -32,41 +32,43 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_activate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_activate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function activates the specified application timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_system_activate Actual timer activation function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function activates the specified application timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_system_activate Actual timer activation function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_activate(TX_TIMER *timer_ptr) @@ -81,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 @@ -92,7 +94,7 @@ UINT status; TX_EL_TIMER_ACTIVATE_INSERT #endif - /* Check for an already active timer. */ + /* Check for an already active timer. */ if (timer_ptr -> tx_timer_internal.tx_timer_internal_list_head != TX_NULL) { diff --git a/common_smp/src/tx_timer_change.c b/common_smp/src/tx_timer_change.c index 7ebc1989..d051078e 100644 --- a/common_smp/src/tx_timer_change.c +++ b/common_smp/src/tx_timer_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,44 +30,46 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_change PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_change PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function modifies an application timer as specified by the */ -/* input. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* initial_ticks Initial expiration ticks */ -/* reschedule_ticks Reschedule ticks */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function modifies an application timer as specified by the */ +/* input. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* initial_ticks Initial expiration ticks */ +/* reschedule_ticks Reschedule ticks */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks) @@ -75,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 @@ -88,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_smp/src/tx_timer_create.c b/common_smp/src/tx_timer_create.c index fb612ebb..1d07e8f4 100644 --- a/common_smp/src/tx_timer_create.c +++ b/common_smp/src/tx_timer_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -31,50 +31,50 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_create PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_create PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function creates an application timer from the specified */ -/* input. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* name_ptr Pointer to timer name */ -/* expiration_function Application expiration function */ -/* initial_ticks Initial expiration ticks */ -/* reschedule_ticks Reschedule ticks */ -/* auto_activate Automatic activation flag */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_system_activate Timer activation function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function creates an application timer from the specified */ +/* input. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* name_ptr Pointer to timer name */ +/* expiration_function Application expiration function */ +/* initial_ticks Initial expiration ticks */ +/* reschedule_ticks Reschedule ticks */ +/* auto_activate Automatic activation flag */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_system_activate Timer activation function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial 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) { @@ -96,11 +96,11 @@ TX_TIMER *previous_timer; timer_ptr -> tx_timer_internal.tx_timer_internal_timeout_param = expiration_input; #ifdef TX_THREAD_SMP_ONLY_CORE_0_DEFAULT - + /* Default the timers to run on core 0. */ timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded = (TX_THREAD_SMP_CORE_MASK & 0xFFFFFFFE); #endif - + /* Disable interrupts to put the timer on the created list. */ TX_DISABLE @@ -130,7 +130,7 @@ TX_TIMER *previous_timer; /* Setup this timer's created links. */ timer_ptr -> tx_timer_created_previous = previous_timer; - timer_ptr -> tx_timer_created_next = next_timer; + timer_ptr -> tx_timer_created_next = next_timer; } /* Increment the number of created timers. */ diff --git a/common_smp/src/tx_timer_deactivate.c b/common_smp/src/tx_timer_deactivate.c index 9dd6bb5b..25175cc6 100644 --- a/common_smp/src/tx_timer_deactivate.c +++ b/common_smp/src/tx_timer_deactivate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,55 +30,57 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_deactivate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_deactivate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deactivates the specified application timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deactivates the specified application timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_deactivate(TX_TIMER *timer_ptr) { TX_INTERRUPT_SAVE_AREA -TX_TIMER_INTERNAL *internal_ptr; +TX_TIMER_INTERNAL *internal_ptr; TX_TIMER_INTERNAL **list_head; -TX_TIMER_INTERNAL *next_timer; -TX_TIMER_INTERNAL *previous_timer; -ULONG ticks_left; +TX_TIMER_INTERNAL *next_timer; +TX_TIMER_INTERNAL *previous_timer; +ULONG ticks_left; UINT active_timer_list; - + /* Setup internal timer pointer. */ internal_ptr = &(timer_ptr -> tx_timer_internal); @@ -123,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) { @@ -137,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); } @@ -146,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; @@ -228,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_smp/src/tx_timer_delete.c b/common_smp/src/tx_timer_delete.c index c2f11260..ba9d9417 100644 --- a/common_smp/src/tx_timer_delete.c +++ b/common_smp/src/tx_timer_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,41 +30,43 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deletes the specified application timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Successful completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_system_deactivate Timer deactivation function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deletes the specified application timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_system_deactivate Timer deactivation function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_delete(TX_TIMER *timer_ptr) @@ -104,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) { @@ -124,9 +126,9 @@ 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; + _tx_timer_created_ptr = next_timer; } } diff --git a/common_smp/src/tx_timer_expiration_process.c b/common_smp/src/tx_timer_expiration_process.c index 235d82ca..de91ea8a 100644 --- a/common_smp/src/tx_timer_expiration_process.c +++ b/common_smp/src/tx_timer_expiration_process.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,45 +30,45 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_expiration_process PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_expiration_process PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function processes thread and application timer expirations. */ -/* It is called from the _tx_timer_interrupt handler and either */ -/* processes the timer expiration in the ISR or defers to the system */ -/* timer thread. The actual processing is determined during */ -/* compilation. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_resume Thread resume processing */ -/* _tx_thread_system_ni_resume Non-interruptable resume thread */ -/* _tx_timer_system_activate Timer reactivate processing */ -/* Timer Expiration Function */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_timer_interrupt Timer interrupt handler */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function processes thread and application timer expirations. */ +/* It is called from the _tx_timer_interrupt handler and either */ +/* processes the timer expiration in the ISR or defers to the system */ +/* timer thread. The actual processing is determined during */ +/* compilation. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_resume Thread resume processing */ +/* _tx_thread_system_ni_resume Non-interruptable resume thread */ +/* _tx_timer_system_activate Timer reactivate processing */ +/* Timer Expiration Function */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_timer_interrupt Timer interrupt handler */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -81,8 +81,8 @@ TX_INTERRUPT_SAVE_AREA #ifdef TX_TIMER_PROCESS_IN_ISR -TX_TIMER_INTERNAL *expired_timers; -TX_TIMER_INTERNAL *reactivate_timer; +TX_TIMER_INTERNAL *expired_timers; +TX_TIMER_INTERNAL *reactivate_timer; TX_TIMER_INTERNAL *next_timer; TX_TIMER_INTERNAL *previous_timer; #ifdef TX_REACTIVATE_INLINE @@ -90,9 +90,9 @@ TX_TIMER_INTERNAL **timer_list; /* Timer list pointer UINT expiration_time; /* Value used for pointer offset*/ ULONG delta; #endif -TX_TIMER_INTERNAL *current_timer; -VOID (*timeout_function)(ULONG id); -ULONG timeout_param = ((ULONG) 0); +TX_TIMER_INTERNAL *current_timer; +VOID (*timeout_function)(ULONG id); +ULONG timeout_param = ((ULONG) 0); #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO TX_TIMER *timer_ptr; #endif @@ -100,7 +100,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. */ @@ -127,8 +127,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. */ @@ -146,7 +146,7 @@ TX_TIMER *timer_ptr; { /* Proceed with timer processing. */ - + /* Set the timer interrupt processing active flag. */ _tx_timer_processing_active = TX_TRUE; @@ -154,7 +154,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. */ @@ -165,19 +165,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; } @@ -197,19 +197,19 @@ 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; /* Determine if this is the only timer. */ if (current_timer == next_timer) - { + { /* Yes, this is the only timer in the list. */ - + /* Set the head pointer to NULL. */ expired_timers = TX_NULL; } @@ -217,7 +217,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; @@ -232,7 +232,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) { @@ -248,25 +248,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; @@ -283,8 +283,8 @@ TX_TIMER *timer_ptr; else { - /* Timer did expire. */ - + /* Timer did expire. */ + #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO /* Increment the total expirations counter. */ @@ -293,22 +293,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; @@ -321,7 +321,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; @@ -348,7 +348,7 @@ TX_TIMER *timer_ptr; /* Call the timer-expiration function, if non-NULL. */ if (timeout_function != TX_NULL) { - + (timeout_function) (timeout_param); } @@ -376,16 +376,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++; } } @@ -413,7 +413,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)) @@ -427,13 +427,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; } @@ -469,7 +469,7 @@ TX_TIMER *timer_ptr; _tx_timer_processing_active = TX_FALSE; } } - + /* Restore interrupts. */ TX_RESTORE #endif diff --git a/common_smp/src/tx_timer_info_get.c b/common_smp/src/tx_timer_info_get.c index af849260..aba17b6b 100644 --- a/common_smp/src/tx_timer_info_get.c +++ b/common_smp/src/tx_timer_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,51 +30,53 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves information from the specified timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* name Destination for the timer name */ -/* active Destination for active flag */ -/* remaining_ticks Destination for remaining ticks */ -/* before expiration */ -/* reschedule_ticks Destination for reschedule ticks */ -/* next_timer Destination for next timer on the */ -/* created list */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves information from the specified timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* name Destination for the timer name */ +/* active Destination for active flag */ +/* remaining_ticks Destination for remaining ticks */ +/* before expiration */ +/* reschedule_ticks Destination for reschedule ticks */ +/* next_timer Destination for next timer on the */ +/* created list */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -99,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); @@ -111,13 +113,13 @@ 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; /* Determine if the timer is still active. */ if (internal_ptr -> tx_timer_internal_list_head != TX_NULL) - { + { /* Indicate this timer is active. */ timer_active = TX_TRUE; @@ -144,15 +146,15 @@ 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; + list_head = internal_ptr -> tx_timer_internal_list_head; /* Is this timer's entry after the current timer pointer? */ 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)); } @@ -168,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; @@ -177,35 +179,35 @@ 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); + ticks_left = ((ULONG) 0); } else { /* 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); + ticks_left = ((ULONG) 0); } } } @@ -214,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; } @@ -228,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_smp/src/tx_timer_initialize.c b/common_smp/src/tx_timer_initialize.c index 47074d77..5790beaa 100644 --- a/common_smp/src/tx_timer_initialize.c +++ b/common_smp/src/tx_timer_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -37,7 +37,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; @@ -73,7 +73,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; @@ -152,8 +152,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; @@ -163,45 +163,45 @@ ULONG _tx_timer_performance__expiration_adjust_count; /* Define the current time slice value. If non-zero, a time-slice is active. - Otherwise, the time_slice is not active. There is one of these entries + Otherwise, the time_slice is not active. There is one of these entries per core. */ ULONG _tx_timer_time_slice[TX_THREAD_SMP_MAX_CORES]; -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_initialize PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_initialize PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the clock control component. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_create Create the system timer thread */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the clock control component. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_create Create the system timer thread */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -250,28 +250,28 @@ 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); /* Define timer initialize extension. */ TX_TIMER_INITIALIZE_EXTENSION(status) - + } while (status != TX_SUCCESS); #else diff --git a/common_smp/src/tx_timer_performance_info_get.c b/common_smp/src/tx_timer_performance_info_get.c index 1304ff40..2c0a7e6e 100644 --- a/common_smp/src/tx_timer_performance_info_get.c +++ b/common_smp/src/tx_timer_performance_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -32,53 +32,55 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_performance_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_performance_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves performance information from the specified */ -/* timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* activates Destination for the number of */ -/* activations of this timer */ -/* reactivates Destination for the number of */ -/* reactivations of this timer */ -/* deactivates Destination for the number of */ -/* deactivations of this timer */ -/* expirations Destination for the number of */ -/* expirations of this timer */ -/* expiration_adjusts Destination for the number of */ -/* expiration adjustments of this */ -/* timer */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves performance information from the specified */ +/* timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* activates Destination for the number of */ +/* activations of this timer */ +/* reactivates Destination for the number of */ +/* reactivations of this timer */ +/* deactivates Destination for the number of */ +/* deactivations of this timer */ +/* expirations Destination for the number of */ +/* expirations of this timer */ +/* expiration_adjusts Destination for the number of */ +/* expiration adjustments of this */ +/* timer */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates, @@ -94,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; } @@ -121,44 +123,44 @@ 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 /* Return successful completion. */ status = TX_SUCCESS; - } + } #else UINT status; diff --git a/common_smp/src/tx_timer_performance_system_info_get.c b/common_smp/src/tx_timer_performance_system_info_get.c index 49536fcc..443c10c3 100644 --- a/common_smp/src/tx_timer_performance_system_info_get.c +++ b/common_smp/src/tx_timer_performance_system_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -32,50 +32,52 @@ #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_performance_system_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_performance_system_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function retrieves timer performance information. */ -/* */ -/* INPUT */ -/* */ -/* activates Destination for total number of */ -/* activations */ -/* reactivates Destination for total number of */ -/* reactivations */ -/* deactivates Destination for total number of */ -/* deactivations */ -/* expirations Destination for total number of */ -/* expirations */ -/* expiration_adjusts Destination for total number of */ -/* expiration adjustments */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function retrieves timer performance information. */ +/* */ +/* INPUT */ +/* */ +/* activates Destination for total number of */ +/* activations */ +/* reactivates Destination for total number of */ +/* reactivations */ +/* deactivates Destination for total number of */ +/* deactivations */ +/* expirations Destination for total number of */ +/* expirations */ +/* expiration_adjusts Destination for total number of */ +/* expiration adjustments */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_timer_performance_system_info_get(ULONG *activates, ULONG *reactivates, @@ -99,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; } @@ -136,7 +138,7 @@ TX_INTERRUPT_SAVE_AREA /* Return completion status. */ return(TX_SUCCESS); - + #else UINT status; @@ -145,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_smp/src/tx_timer_smp_core_exclude.c b/common_smp/src/tx_timer_smp_core_exclude.c index 88a75231..3679e564 100644 --- a/common_smp/src/tx_timer_smp_core_exclude.c +++ b/common_smp/src/tx_timer_smp_core_exclude.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer - High Level SMP Support */ /** */ @@ -32,43 +32,43 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_smp_core_exclude PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_smp_core_exclude PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function allows the application to exclude one or more cores */ -/* from executing the specified timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to the timer */ -/* exclusion_map Bit map of exclusion list, */ -/* where bit 0 set means that */ -/* this thread cannot run on */ -/* core0, etc. */ -/* */ -/* OUTPUT */ -/* */ -/* Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function allows the application to exclude one or more cores */ +/* from executing the specified timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to the timer */ +/* exclusion_map Bit map of exclusion list, */ +/* where bit 0 set means that */ +/* this thread cannot run on */ +/* core0, etc. */ +/* */ +/* OUTPUT */ +/* */ +/* Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -85,7 +85,7 @@ UINT status; /* First, make sure the timer pointer is valid. */ if (timer_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_TIMER_ERROR; } @@ -93,7 +93,7 @@ UINT status; /* Check for valid ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { - + /* Return pointer error. */ status = TX_TIMER_ERROR; } @@ -104,16 +104,16 @@ UINT status; TX_DISABLE /* Now store in the core exclusion information. */ - timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded = (timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded & ~(((ULONG) TX_THREAD_SMP_CORE_MASK))) | + timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded = (timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded & ~(((ULONG) TX_THREAD_SMP_CORE_MASK))) | (exclusion_map & ((ULONG) TX_THREAD_SMP_CORE_MASK)); /* Restore interrupts. */ TX_RESTORE - + /* Return success. */ status = TX_SUCCESS; } - + /* Return success. */ return(status); } diff --git a/common_smp/src/tx_timer_smp_core_exclude_get.c b/common_smp/src/tx_timer_smp_core_exclude_get.c index 51d9ae27..360a9080 100644 --- a/common_smp/src/tx_timer_smp_core_exclude_get.c +++ b/common_smp/src/tx_timer_smp_core_exclude_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer - High Level SMP Support */ /** */ @@ -32,40 +32,40 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_smp_core_exclude_get PROTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_smp_core_exclude_get PROTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns the current exclusion list for the timer. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to the timer */ -/* exclusion_map_ptr Destination for the current */ -/* exclusion list */ -/* */ -/* OUTPUT */ -/* */ -/* Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function returns the current exclusion list for the timer. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to the timer */ +/* exclusion_map_ptr Destination for the current */ +/* exclusion list */ +/* */ +/* OUTPUT */ +/* */ +/* Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -74,13 +74,13 @@ UINT _tx_timer_smp_core_exclude_get(TX_TIMER *timer_ptr, ULONG *exclusion_map_ptr) { -UINT status; +UINT status; /* First, make sure the timer pointer is valid. */ if (timer_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_TIMER_ERROR; } @@ -88,7 +88,7 @@ UINT status; /* Check for valid ID. */ else if (timer_ptr -> tx_timer_id != TX_TIMER_ID) { - + /* Return pointer error. */ status = TX_TIMER_ERROR; } @@ -96,7 +96,7 @@ UINT status; /* Is the destination pointer NULL? */ else if (exclusion_map_ptr == TX_NULL) { - + /* Return pointer error. */ status = TX_PTR_ERROR; } @@ -105,11 +105,11 @@ UINT status; /* Save the current exclusion map in the destination. */ *exclusion_map_ptr = (timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded) & ((ULONG) TX_THREAD_SMP_CORE_MASK); - + /* Set the status to success. */ status = TX_SUCCESS; } - + /* Return success. */ return(status); } diff --git a/common_smp/src/tx_timer_system_activate.c b/common_smp/src/tx_timer_system_activate.c index d54211b4..fa03a6c8 100644 --- a/common_smp/src/tx_timer_system_activate.c +++ b/common_smp/src/tx_timer_system_activate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -29,43 +29,43 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_system_activate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_system_activate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function places the specified internal timer in the proper */ -/* place in the timer expiration list. If the timer is already active */ -/* this function does nothing. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_system_suspend Thread suspend function */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* _tx_timer_thread_entry Timer thread processing */ -/* _tx_timer_activate Application timer activate */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function places the specified internal timer in the proper */ +/* place in the timer expiration list. If the timer is already active */ +/* this function does nothing. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_system_suspend Thread suspend function */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* _tx_timer_thread_entry Timer thread processing */ +/* _tx_timer_activate Application timer activate */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -88,11 +88,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. */ @@ -119,7 +119,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)) @@ -129,11 +129,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. */ @@ -142,7 +142,7 @@ ULONG expiration_time; /* Setup the list head pointer. */ *timer_list = timer_ptr; - } + } else { diff --git a/common_smp/src/tx_timer_system_deactivate.c b/common_smp/src/tx_timer_system_deactivate.c index cfc97e7b..909bf458 100644 --- a/common_smp/src/tx_timer_system_deactivate.c +++ b/common_smp/src/tx_timer_system_deactivate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -29,52 +29,54 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_system_deactivate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_system_deactivate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function deactivates, or removes the timer from the active */ -/* timer expiration list. If the timer is already deactivated, this */ -/* function just returns. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SUCCESS Always returns success */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_thread_system_resume Thread resume function */ -/* _tx_timer_thread_entry Timer thread processing */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function deactivates, or removes the timer from the active */ +/* timer expiration list. If the timer is already deactivated, this */ +/* function just returns. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SUCCESS Always returns success */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_thread_system_resume Thread resume function */ +/* _tx_timer_thread_entry Timer thread processing */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_timer_system_deactivate(TX_TIMER_INTERNAL *timer_ptr) { TX_TIMER_INTERNAL **list_head; -TX_TIMER_INTERNAL *next_timer; -TX_TIMER_INTERNAL *previous_timer; +TX_TIMER_INTERNAL *next_timer; +TX_TIMER_INTERNAL *previous_timer; /* Pickup the list head pointer. */ diff --git a/common_smp/src/tx_timer_thread_entry.c b/common_smp/src/tx_timer_thread_entry.c index f2cfa3aa..0a6e77de 100644 --- a/common_smp/src/tx_timer_thread_entry.c +++ b/common_smp/src/tx_timer_thread_entry.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -31,43 +31,43 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_timer_thread_entry PORTABLE SMP */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_timer_thread_entry PORTABLE SMP */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function manages thread and application timer expirations. */ -/* Actually, from this thread's point of view, there is no difference. */ -/* */ -/* INPUT */ -/* */ -/* timer_thread_input Used just for verification */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* Timer Expiration Function */ -/* _tx_thread_system_suspend Thread suspension */ -/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ -/* _tx_timer_system_activate Timer reactivate processing */ -/* _tx_thread_smp_core_exclude Exclude core from timer execution */ -/* */ -/* CALLED BY */ -/* */ -/* ThreadX Scheduler */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function manages thread and application timer expirations. */ +/* Actually, from this thread's point of view, there is no difference. */ +/* */ +/* INPUT */ +/* */ +/* timer_thread_input Used just for verification */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* Timer Expiration Function */ +/* _tx_thread_system_suspend Thread suspension */ +/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */ +/* _tx_timer_system_activate Timer reactivate processing */ +/* _tx_thread_smp_core_exclude Exclude core from timer execution */ +/* */ +/* CALLED BY */ +/* */ +/* ThreadX Scheduler */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ @@ -79,13 +79,13 @@ VOID _tx_timer_thread_entry(ULONG timer_thread_input) TX_INTERRUPT_SAVE_AREA -TX_TIMER_INTERNAL *expired_timers; -TX_TIMER_INTERNAL *reactivate_timer; +TX_TIMER_INTERNAL *expired_timers; +TX_TIMER_INTERNAL *reactivate_timer; TX_TIMER_INTERNAL *next_timer; TX_TIMER_INTERNAL *previous_timer; -TX_TIMER_INTERNAL *current_timer; -VOID (*timeout_function)(ULONG id); -ULONG timeout_param = ((ULONG) 0); +TX_TIMER_INTERNAL *current_timer; +VOID (*timeout_function)(ULONG id); +ULONG timeout_param = ((ULONG) 0); TX_THREAD *thread_ptr; #ifdef TX_REACTIVATE_INLINE TX_TIMER_INTERNAL **timer_list; /* Timer list pointer */ @@ -113,7 +113,7 @@ UINT status; 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 @@ -125,7 +125,7 @@ UINT status; is one! */ if (expired_timers != TX_NULL) { - + expired_timers -> tx_timer_internal_list_head = &expired_timers; /* Pickup the current core exclusion bit map for this timer. */ @@ -141,12 +141,12 @@ UINT status; /* 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; } @@ -159,7 +159,7 @@ UINT status; /* Determine if we need to change the processor exclusion setting. */ if ((_tx_timer_thread.tx_thread_smp_cores_excluded & ((ULONG) TX_THREAD_SMP_CORE_MASK)) != core_exclusion) { - + #ifdef TX_MISRA_ENABLE do { @@ -171,7 +171,7 @@ UINT status; /* Setup the new core exclusion for execution this timer. */ _tx_thread_smp_core_exclude(&_tx_timer_thread, core_exclusion); #endif - + /* When we get to this point, the system timer thread is executing on one of the allowed cores. */ } @@ -188,7 +188,7 @@ UINT status; /* Pickup the next timer. */ next_timer = expired_timers -> tx_timer_internal_active_next; - + /* Set the reactivate_timer to NULL. */ reactivate_timer = TX_NULL; @@ -208,7 +208,7 @@ UINT status; { /* 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; @@ -226,7 +226,7 @@ UINT status; /* 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) { @@ -242,25 +242,25 @@ UINT status; /* 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; @@ -287,22 +287,22 @@ UINT status; /* 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; @@ -315,7 +315,7 @@ UINT status; { /* 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; @@ -345,7 +345,7 @@ UINT status; /* Call the timer-expiration function, if non-NULL. */ if (timeout_function != TX_NULL) { - + (timeout_function) (timeout_param); } @@ -376,16 +376,16 @@ UINT status; /* 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++; } } @@ -412,7 +412,7 @@ UINT status; /* 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)) @@ -420,13 +420,13 @@ UINT status; /* Wrap from the beginning of the list. */ delta = TX_TIMER_POINTER_DIF(timer_list, _tx_timer_list_end); - timer_list = TX_TIMER_POINTER_ADD(_tx_timer_list_start, delta); + 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. */ @@ -468,7 +468,7 @@ UINT status; /* Determine if we need to change the core exclusion setting. */ if (_tx_timer_thread.tx_thread_smp_cores_excluded != core_exclusion) { - + #ifdef TX_MISRA_ENABLE do { @@ -477,11 +477,11 @@ UINT status; status = _tx_thread_smp_core_exclude(&_tx_timer_thread, core_exclusion); } while (status != TX_SUCCESS); #else - + /* Setup the new core exclusion for execution this timer. */ _tx_thread_smp_core_exclude(&_tx_timer_thread, core_exclusion); #endif - + /* When we get to this point, the system timer thread is executing on one of the allowed cores. */ } @@ -501,7 +501,7 @@ UINT status; /* 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; @@ -533,7 +533,7 @@ UINT status; /* Restore interrupts. */ TX_RESTORE } - } + } } #ifdef TX_SAFETY_CRITICAL diff --git a/common_smp/src/tx_trace_buffer_full_notify.c b/common_smp/src/tx_trace_buffer_full_notify.c index 5be36eba..383b134a 100644 --- a/common_smp/src/tx_trace_buffer_full_notify.c +++ b/common_smp/src/tx_trace_buffer_full_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -31,45 +31,47 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_buffer_full_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_buffer_full_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function sets up the application callback function that is */ -/* called whenever the trace buffer becomes full. The application */ -/* can then swap to a new trace buffer in order not to lose any */ -/* events. */ -/* */ -/* INPUT */ -/* */ -/* full_buffer_callback Full trace buffer processing */ -/* function */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function sets up the application callback function that is */ +/* called whenever the trace buffer becomes full. The application */ +/* can then swap to a new trace buffer in order not to lose any */ +/* events. */ +/* */ +/* INPUT */ +/* */ +/* full_buffer_callback Full trace buffer processing */ +/* function */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer)) @@ -82,7 +84,7 @@ UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer)) /* Return success. */ return(TX_SUCCESS); - + #else UINT status; @@ -91,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_smp/src/tx_trace_disable.c b/common_smp/src/tx_trace_disable.c index 202fadb0..dbf8f3b2 100644 --- a/common_smp/src/tx_trace_disable.c +++ b/common_smp/src/tx_trace_disable.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -29,41 +29,43 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_disable PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_disable PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function disables trace inside of ThreadX. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ +/* */ +/* This function disables trace inside of ThreadX. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_disable(VOID) @@ -71,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; } @@ -86,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_smp/src/tx_trace_enable.c b/common_smp/src/tx_trace_enable.c index 086a3dea..b325bac0 100644 --- a/common_smp/src/tx_trace_enable.c +++ b/common_smp/src/tx_trace_enable.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -39,46 +39,48 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_enable PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_enable PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the ThreadX trace buffer and the */ -/* associated control variables, enabling it for operation. */ -/* */ -/* INPUT */ -/* */ -/* trace_buffer_start Start of trace buffer */ -/* trace_buffer_size Size (bytes) of trace buffer */ -/* registry_entries Number of object registry */ -/* entries. */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_trace_object_register Register existing objects */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function initializes the ThreadX trace buffer and the */ +/* associated control variables, enabling it for operation. */ +/* */ +/* INPUT */ +/* */ +/* trace_buffer_start Start of trace buffer */ +/* trace_buffer_size Size (bytes) of trace buffer */ +/* registry_entries Number of object registry */ +/* entries. */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_trace_object_register Register existing objects */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_enable(VOID *trace_buffer_start, ULONG trace_buffer_size, ULONG registry_entries) @@ -104,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)))) { @@ -116,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; } @@ -152,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; @@ -163,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); @@ -178,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; @@ -195,14 +197,14 @@ 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); } /* Now, fill in the event trace control header. */ _tx_trace_header_ptr -> tx_trace_header_id = TX_TRACE_VALID; - _tx_trace_header_ptr -> tx_trace_header_timer_valid_mask = TX_TRACE_TIME_MASK; + _tx_trace_header_ptr -> tx_trace_header_timer_valid_mask = TX_TRACE_TIME_MASK; _tx_trace_header_ptr -> tx_trace_header_trace_base_address = TX_POINTER_TO_ULONG_CONVERT(trace_buffer_start); _tx_trace_header_ptr -> tx_trace_header_registry_start_pointer = TX_POINTER_TO_ULONG_CONVERT(_tx_trace_registry_start_ptr); _tx_trace_header_ptr -> tx_trace_header_reserved1 = ((USHORT) 0); @@ -236,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. */ @@ -257,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. */ @@ -295,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. */ @@ -332,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. */ @@ -351,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. */ @@ -370,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. */ @@ -383,7 +385,7 @@ UINT status; /* Release the preeemption. */ _tx_thread_preempt_disable--; - /* Finally, setup the current buffer pointer, which effectively enables the trace! */ + /* Finally, setup the current buffer pointer, which effectively enables the trace! */ _tx_trace_buffer_current_ptr = (TX_TRACE_BUFFER_ENTRY *) _tx_trace_buffer_start_ptr; /* Insert two RUNNING events so the buffer is not empty. */ @@ -399,7 +401,7 @@ UINT status; /* Return successful completion. */ status = TX_SUCCESS; } - + /* Return completion status. */ return(status); #else @@ -410,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_smp/src/tx_trace_event_filter.c b/common_smp/src/tx_trace_event_filter.c index 0534d3a5..ed97f8a3 100644 --- a/common_smp/src/tx_trace_event_filter.c +++ b/common_smp/src/tx_trace_event_filter.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -31,42 +31,44 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_event_filter PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_event_filter PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function sets up the event filter, which allows the */ -/* application to filter various trace events during run-time. */ -/* */ -/* INPUT */ -/* */ -/* event_filter_bits Trace filter event bit(s) */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function sets up the event filter, which allows the */ +/* application to filter various trace events during run-time. */ +/* */ +/* INPUT */ +/* */ +/* event_filter_bits Trace filter event bit(s) */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_event_filter(ULONG event_filter_bits) @@ -88,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_smp/src/tx_trace_event_unfilter.c b/common_smp/src/tx_trace_event_unfilter.c index fa01bb1f..f65690ec 100644 --- a/common_smp/src/tx_trace_event_unfilter.c +++ b/common_smp/src/tx_trace_event_unfilter.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -31,42 +31,44 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_event_unfilter PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_event_unfilter PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function removes the event filter, which allows the */ -/* application to un-filter various trace events during run-time. */ -/* */ -/* INPUT */ -/* */ -/* event_unfilter_bits Trace un-filter event bit(s) */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function removes the event filter, which allows the */ +/* application to un-filter various trace events during run-time. */ +/* */ +/* INPUT */ +/* */ +/* event_unfilter_bits Trace un-filter event bit(s) */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_event_unfilter(ULONG event_unfilter_bits) @@ -79,7 +81,7 @@ UINT _tx_trace_event_unfilter(ULONG event_unfilter_bits) /* Return success. */ return(TX_SUCCESS); - + #else UINT status; diff --git a/common_smp/src/tx_trace_initialize.c b/common_smp/src/tx_trace_initialize.c index f9b477cb..d904740a 100644 --- a/common_smp/src/tx_trace_initialize.c +++ b/common_smp/src/tx_trace_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -60,8 +60,8 @@ 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 - or disabled dynamically by the application. */ +/* 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); @@ -95,42 +95,44 @@ ULONG _tx_trace_registry_search_start; #endif -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_initialize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_initialize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the trace component. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the trace component. */ +/* */ +/* INPUT */ +/* */ /* None */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* _tx_initialize_high_level High level initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_high_level High level initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_trace_initialize(VOID) diff --git a/common_smp/src/tx_trace_interrupt_control.c b/common_smp/src/tx_trace_interrupt_control.c index d729c829..d3020e67 100644 --- a/common_smp/src/tx_trace_interrupt_control.c +++ b/common_smp/src/tx_trace_interrupt_control.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -30,42 +30,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_interrupt_control PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_interrupt_control PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function provides a shell for the tx_interrupt_control */ -/* function so that a trace event can be logged for its use. */ -/* */ -/* INPUT */ -/* */ -/* new_posture New interrupt posture */ -/* */ -/* OUTPUT */ -/* */ -/* Previous Interrupt Posture */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_interrupt_control Interrupt control service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function provides a shell for the tx_interrupt_control */ +/* function so that a trace event can be logged for its use. */ +/* */ +/* INPUT */ +/* */ +/* new_posture New interrupt posture */ +/* */ +/* OUTPUT */ +/* */ +/* Previous Interrupt Posture */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_interrupt_control Interrupt control service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_interrupt_control(UINT new_posture) diff --git a/common_smp/src/tx_trace_isr_enter_insert.c b/common_smp/src/tx_trace_isr_enter_insert.c index 29042de7..fa29b750 100644 --- a/common_smp/src/tx_trace_isr_enter_insert.c +++ b/common_smp/src/tx_trace_isr_enter_insert.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -32,42 +32,44 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_isr_enter_insert PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_isr_enter_insert PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function provides inserts an ISR entry event into the trace */ -/* buffer. */ -/* */ -/* INPUT */ -/* */ -/* isr_id User defined ISR ID */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function provides inserts an ISR entry event into the trace */ +/* buffer. */ +/* */ +/* INPUT */ +/* */ +/* isr_id User defined ISR ID */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_trace_isr_enter_insert(ULONG isr_id) @@ -98,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_smp/src/tx_trace_isr_exit_insert.c b/common_smp/src/tx_trace_isr_exit_insert.c index 5b9bf0f2..ff0ec6c8 100644 --- a/common_smp/src/tx_trace_isr_exit_insert.c +++ b/common_smp/src/tx_trace_isr_exit_insert.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -32,42 +32,44 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_isr_exit_insert PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_isr_exit_insert PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function provides inserts an ISR exit event into the trace */ -/* buffer. */ -/* */ -/* INPUT */ -/* */ -/* isr_id User defined ISR ID */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function provides inserts an ISR exit event into the trace */ +/* buffer. */ +/* */ +/* INPUT */ +/* */ +/* isr_id User defined ISR ID */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_trace_isr_exit_insert(ULONG isr_id) @@ -98,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_smp/src/tx_trace_object_register.c b/common_smp/src/tx_trace_object_register.c index aa297e8b..da2dafcf 100644 --- a/common_smp/src/tx_trace_object_register.c +++ b/common_smp/src/tx_trace_object_register.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -29,47 +29,49 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_object_register PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_object_register PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function registers a ThreadX system object in the trace */ -/* registry area. This provides a mapping between the object pointers */ -/* stored in each trace event to the actual ThreadX objects. */ -/* */ -/* INPUT */ -/* */ -/* object_type Type of system object */ -/* object_ptr Address of system object */ -/* object_name Name of system object */ -/* parameter_1 Supplemental parameter 1 */ -/* parameter_2 Supplemental parameter 2 */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* This function registers a ThreadX system object in the trace */ +/* registry area. This provides a mapping between the object pointers */ +/* stored in each trace event to the actual ThreadX objects. */ +/* */ +/* INPUT */ +/* */ +/* object_type Type of system object */ +/* object_ptr Address of system object */ +/* object_name Name of system object */ +/* parameter_1 Supplemental parameter 1 */ +/* parameter_2 Supplemental parameter 2 */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2) @@ -96,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. */ @@ -123,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)) { @@ -132,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; } @@ -152,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. */ @@ -188,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; @@ -220,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; @@ -239,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); @@ -265,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_smp/src/tx_trace_object_unregister.c b/common_smp/src/tx_trace_object_unregister.c index 0bcf98cf..5c1bc7d2 100644 --- a/common_smp/src/tx_trace_object_unregister.c +++ b/common_smp/src/tx_trace_object_unregister.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -29,42 +29,44 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_object_unregister PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_object_unregister PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function unregisters a ThreadX system object from the trace */ -/* registry area. */ -/* */ -/* INPUT */ -/* */ -/* object_pointer Address of system object */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* This function unregisters a ThreadX system object from the trace */ +/* registry area. */ +/* */ +/* INPUT */ +/* */ +/* object_pointer Address of system object */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _tx_trace_object_unregister(VOID *object_ptr) @@ -99,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); @@ -121,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_smp/src/tx_trace_user_event_insert.c b/common_smp/src/tx_trace_user_event_insert.c index cac68502..6d0b4004 100644 --- a/common_smp/src/tx_trace_user_event_insert.c +++ b/common_smp/src/tx_trace_user_event_insert.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Trace */ /** */ @@ -29,45 +29,47 @@ #include "tx_trace.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_trace_user_event_insert PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_trace_user_event_insert PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function inserts a user-defined event into the trace buffer. */ -/* */ -/* INPUT */ -/* */ -/* event_id User Event ID */ -/* info_field_1 First information field */ -/* info_field_2 First information field */ -/* info_field_3 First information field */ -/* info_field_4 First information field */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ +/* */ +/* This function inserts a user-defined event into the trace buffer. */ +/* */ +/* INPUT */ +/* */ +/* event_id User Event ID */ +/* info_field_1 First information field */ +/* info_field_2 First information field */ +/* info_field_3 First information field */ +/* info_field_4 First information field */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _tx_trace_user_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4) @@ -86,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; } @@ -99,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; } @@ -109,7 +111,7 @@ UINT status; /* Return completion status. */ return(status); - + #else UINT status; diff --git a/common_smp/src/txe_block_allocate.c b/common_smp/src/txe_block_allocate.c index 81e02e28..cf4c2ed4 100644 --- a/common_smp/src/txe_block_allocate.c +++ b/common_smp/src/txe_block_allocate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -31,54 +31,56 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_block_allocate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_block_allocate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the allocate block memory */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* block_ptr Pointer to place allocated block */ +/* */ +/* This function checks for errors in the allocate block memory */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* block_ptr Pointer to place allocated block */ /* pointer */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid pool pointer */ -/* TX_PTR_ERROR Invalid destination pointer */ -/* TX_WAIT_ERROR Invalid wait option */ -/* status Actual Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_allocate Actual block allocate function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid pool pointer */ +/* TX_PTR_ERROR Invalid destination pointer */ +/* TX_WAIT_ERROR Invalid wait option */ +/* status Actual Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_allocate Actual block allocate function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -89,7 +91,7 @@ TX_THREAD *current_thread; status = TX_SUCCESS; /* Check for an invalid pool pointer. */ - if (pool_ptr == TX_NULL) + if (pool_ptr == TX_NULL) { /* Pool pointer is invalid, return appropriate error code. */ @@ -111,10 +113,10 @@ TX_THREAD *current_thread; /* Null destination pointer, return appropriate error. */ status = TX_PTR_ERROR; } - else + 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,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_smp/src/txe_block_pool_create.c b/common_smp/src/txe_block_pool_create.c index 3f9b8fe9..d964f1cb 100644 --- a/common_smp/src/txe_block_pool_create.c +++ b/common_smp/src/txe_block_pool_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -32,52 +32,54 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_block_pool_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_block_pool_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the create block memory pool */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* name_ptr Pointer to block pool name */ -/* block_size Number of bytes in each block */ -/* pool_start Address of beginning of pool area */ -/* pool_size Number of bytes in the block pool */ -/* pool_control_block_size Size of block pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid pool pointer */ -/* TX_PTR_ERROR Invalid starting address */ -/* TX_SIZE_ERROR Invalid pool size */ -/* TX_CALLER_ERROR Invalid caller of pool */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_pool_create Actual block pool create function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the create block memory pool */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* name_ptr Pointer to block pool name */ +/* block_size Number of bytes in each block */ +/* pool_start Address of beginning of pool area */ +/* pool_size Number of bytes in the block pool */ +/* pool_control_block_size Size of block pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid pool pointer */ +/* TX_PTR_ERROR Invalid starting address */ +/* TX_SIZE_ERROR Invalid pool size */ +/* TX_CALLER_ERROR Invalid caller of pool */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_pool_create Actual block pool create function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, @@ -86,7 +88,7 @@ UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG bloc TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_BLOCK_POOL *next_pool; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -147,7 +149,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -173,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 *)))) { @@ -200,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_smp/src/txe_block_pool_delete.c b/common_smp/src/txe_block_pool_delete.c index 52316fb1..2ee152b9 100644 --- a/common_smp/src/txe_block_pool_delete.c +++ b/common_smp/src/txe_block_pool_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -31,50 +31,52 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_block_pool_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_block_pool_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the delete block pool memory */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid memory block pool pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual delete function status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_pool_delete Actual block pool delete function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the delete block pool memory */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid memory block pool pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual delete function status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_pool_delete Actual block pool delete function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -85,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) { @@ -97,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; } @@ -107,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; } @@ -134,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_smp/src/txe_block_pool_info_get.c b/common_smp/src/txe_block_pool_info_get.c index 82659892..ecd544c4 100644 --- a/common_smp/src/txe_block_pool_info_get.c +++ b/common_smp/src/txe_block_pool_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Memory */ /** */ @@ -29,55 +29,57 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_block_pool_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_block_pool_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the block pool information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to block pool control blk */ -/* name Destination for the pool name */ -/* available_blocks Number of free blocks in pool */ -/* total_blocks Total number of blocks in pool */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on block pool */ -/* suspended_count Destination for suspended count */ -/* next_pool Destination for pointer to next */ -/* block pool on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid block pool pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_pool_info_get Actual block pool info get service*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the block pool information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to block pool control blk */ +/* name Destination for the pool name */ +/* available_blocks Number of free blocks in pool */ +/* total_blocks Total number of blocks in pool */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on block pool */ +/* suspended_count Destination for suspended count */ +/* next_pool Destination for pointer to next */ +/* block pool on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid block pool pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_pool_info_get Actual block pool info get service*/ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -104,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_smp/src/txe_block_pool_prioritize.c b/common_smp/src/txe_block_pool_prioritize.c index 2caed6a3..5d9088d5 100644 --- a/common_smp/src/txe_block_pool_prioritize.c +++ b/common_smp/src/txe_block_pool_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -29,42 +29,44 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_block_pool_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_block_pool_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the block pool prioritize call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_pool_prioritize Actual block pool prioritize */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the block pool prioritize call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_pool_prioritize Actual block pool prioritize */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr) @@ -81,7 +83,7 @@ UINT status; status = TX_POOL_ERROR; } - /* Now check for invalid pool ID. */ + /* Now check for invalid pool ID. */ else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID) { diff --git a/common_smp/src/txe_block_release.c b/common_smp/src/txe_block_release.c index 614b7eee..7c4ca6aa 100644 --- a/common_smp/src/txe_block_release.c +++ b/common_smp/src/txe_block_release.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Block Pool */ /** */ @@ -29,51 +29,53 @@ #include "tx_block_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_block_release PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_block_release PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the block release function call. */ -/* */ -/* INPUT */ -/* */ -/* block_ptr Pointer to memory block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_PTR_ERROR Invalid memory block pointer */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_block_release Actual block release function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the block release function call. */ +/* */ +/* INPUT */ +/* */ +/* block_ptr Pointer to memory block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_PTR_ERROR Invalid memory block pointer */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_block_release Actual block release function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_block_release(VOID *block_ptr) { -UINT status; -TX_BLOCK_POOL *pool_ptr; +UINT status; +TX_BLOCK_POOL *pool_ptr; UCHAR **indirect_ptr; -UCHAR *work_ptr; +UCHAR *work_ptr; /* First check the supplied pointer. */ @@ -86,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 *))); @@ -101,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_smp/src/txe_byte_allocate.c b/common_smp/src/txe_byte_allocate.c index 3c226c11..7c522bae 100644 --- a/common_smp/src/txe_byte_allocate.c +++ b/common_smp/src/txe_byte_allocate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -32,57 +32,59 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_byte_allocate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_byte_allocate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in allocate bytes function call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* memory_ptr Pointer to place allocated bytes */ +/* */ +/* This function checks for errors in allocate bytes function call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* memory_ptr Pointer to place allocated bytes */ /* pointer */ -/* memory_size Number of bytes to allocate */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid memory pool pointer */ -/* TX_PTR_ERROR Invalid destination pointer */ -/* TX_WAIT_ERROR Invalid wait option */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* TX_SIZE_ERROR Invalid size of memory request */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_allocate Actual byte allocate function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* memory_size Number of bytes to allocate */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid memory pool pointer */ +/* TX_PTR_ERROR Invalid destination pointer */ +/* TX_WAIT_ERROR Invalid wait option */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* TX_SIZE_ERROR Invalid size of memory request */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_allocate Actual byte allocate function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -94,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; } @@ -122,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) { @@ -131,10 +133,10 @@ TX_THREAD *thread_ptr; status = TX_SIZE_ERROR; } - else + 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) { @@ -142,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) { @@ -170,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_smp/src/txe_byte_pool_create.c b/common_smp/src/txe_byte_pool_create.c index 55659b42..291a7c74 100644 --- a/common_smp/src/txe_byte_pool_create.c +++ b/common_smp/src/txe_byte_pool_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Pool */ /** */ @@ -32,51 +32,53 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_byte_pool_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_byte_pool_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the create byte pool memory */ -/* function. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* name_ptr Pointer to byte pool name */ -/* pool_start Address of beginning of pool area */ -/* pool_size Number of bytes in the byte pool */ -/* pool_control_block_size Size of byte pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid byte pool pointer */ -/* TX_PTR_ERROR Invalid pool starting address */ -/* TX_SIZE_ERROR Invalid pool size */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_pool_create Actual byte pool create function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the create byte pool memory */ +/* function. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* name_ptr Pointer to byte pool name */ +/* pool_start Address of beginning of pool area */ +/* pool_size Number of bytes in the byte pool */ +/* pool_control_block_size Size of byte pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid byte pool pointer */ +/* TX_PTR_ERROR Invalid pool starting address */ +/* TX_SIZE_ERROR Invalid pool size */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_pool_create Actual byte pool create function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size) @@ -84,7 +86,7 @@ UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_s TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_BYTE_POOL *next_pool; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -96,7 +98,7 @@ TX_THREAD *thread_ptr; status = TX_SUCCESS; /* Check for an invalid byte pool pointer. */ - if (pool_ptr == TX_NULL) + if (pool_ptr == TX_NULL) { /* Byte pool pointer is invalid, return appropriate error code. */ @@ -112,7 +114,7 @@ TX_THREAD *thread_ptr; } else { - + /* Disable interrupts. */ TX_DISABLE @@ -146,7 +148,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -164,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; } @@ -196,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_smp/src/txe_byte_pool_delete.c b/common_smp/src/txe_byte_pool_delete.c index 98793495..28f33dff 100644 --- a/common_smp/src/txe_byte_pool_delete.c +++ b/common_smp/src/txe_byte_pool_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Pool */ /** */ @@ -31,50 +31,52 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_byte_pool_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_byte_pool_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the delete byte pool function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid pool pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_pool_delete Actual byte pool delete function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the delete byte pool function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid pool pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_pool_delete Actual byte pool delete function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -85,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) { @@ -105,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; } @@ -132,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_smp/src/txe_byte_pool_info_get.c b/common_smp/src/txe_byte_pool_info_get.c index 6596a45c..69ec38c6 100644 --- a/common_smp/src/txe_byte_pool_info_get.c +++ b/common_smp/src/txe_byte_pool_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -29,55 +29,57 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_byte_pool_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_byte_pool_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the byte pool information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to byte pool control block*/ -/* name Destination for the pool name */ -/* available_bytes Number of free bytes in byte pool */ -/* fragments Number of fragments in byte pool */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on byte pool */ -/* suspended_count Destination for suspended count */ -/* next_pool Destination for pointer to next */ -/* byte pool on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_POOL_ERROR Invalid byte pool pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_pool_info_get Actual byte pool info get service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the byte pool information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to byte pool control block*/ +/* name Destination for the pool name */ +/* available_bytes Number of free bytes in byte pool */ +/* fragments Number of fragments in byte pool */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on byte pool */ +/* suspended_count Destination for suspended count */ +/* next_pool Destination for pointer to next */ +/* byte pool on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_POOL_ERROR Invalid byte pool pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_pool_info_get Actual byte pool info get service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -103,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_smp/src/txe_byte_pool_prioritize.c b/common_smp/src/txe_byte_pool_prioritize.c index cf239aae..3a09dd37 100644 --- a/common_smp/src/txe_byte_pool_prioritize.c +++ b/common_smp/src/txe_byte_pool_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -29,42 +29,44 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_byte_pool_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_byte_pool_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the byte pool prioritize call. */ -/* */ -/* INPUT */ -/* */ -/* pool_ptr Pointer to pool control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_pool_prioritize Actual byte pool prioritize */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the byte pool prioritize call. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_pool_prioritize Actual byte pool prioritize */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr) @@ -74,13 +76,13 @@ UINT status; /* Check for an invalid byte memory pool pointer. */ - if (pool_ptr == TX_NULL) + 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) { diff --git a/common_smp/src/txe_byte_release.c b/common_smp/src/txe_byte_release.c index 4268c804..99000210 100644 --- a/common_smp/src/txe_byte_release.c +++ b/common_smp/src/txe_byte_release.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Byte Memory */ /** */ @@ -32,49 +32,51 @@ #include "tx_byte_pool.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_byte_release PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_byte_release PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the release byte function call. */ -/* */ -/* INPUT */ -/* */ -/* memory_ptr Pointer to allocated memory */ -/* */ -/* OUTPUT */ -/* */ -/* TX_PTR_ERROR Invalid memory pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_byte_release Actual byte release function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the release byte function call. */ +/* */ +/* INPUT */ +/* */ +/* memory_ptr Pointer to allocated memory */ +/* */ +/* OUTPUT */ +/* */ +/* TX_PTR_ERROR Invalid memory pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_byte_release Actual byte release function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_byte_release(VOID *memory_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -110,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_smp/src/txe_event_flags_create.c b/common_smp/src/txe_event_flags_create.c index be730563..67da058a 100644 --- a/common_smp/src/txe_event_flags_create.c +++ b/common_smp/src/txe_event_flags_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -32,48 +32,50 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the event flag creation function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to event flags group */ -/* control block */ -/* name_ptr Pointer to event flags name */ +/* */ +/* This function checks for errors in the event flag creation function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to event flags group */ +/* control block */ +/* name_ptr Pointer to event flags name */ /* event_control_block_size Size of event flags control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_GROUP_ERROR Invalid event flag group pointer */ -/* TX_CALLER_ERROR Invalid calling function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_create Actual create function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_GROUP_ERROR Invalid event flag group pointer */ +/* TX_CALLER_ERROR Invalid calling function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_create Actual create function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size) @@ -81,7 +83,7 @@ UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, U TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_EVENT_FLAGS_GROUP *next_group; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -127,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; } @@ -143,7 +145,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -177,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_smp/src/txe_event_flags_delete.c b/common_smp/src/txe_event_flags_delete.c index 159f192e..5a4031c8 100644 --- a/common_smp/src/txe_event_flags_delete.c +++ b/common_smp/src/txe_event_flags_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,50 +31,52 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the delete event flags group */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_GROUP_ERROR Invalid event flag group pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_delete Actual delete event flags function*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the delete event flags group */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_GROUP_ERROR Invalid event flag group pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_delete Actual delete event flags function*/ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -85,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) { @@ -93,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_smp/src/txe_event_flags_get.c b/common_smp/src/txe_event_flags_get.c index 3a1d0164..a77b6269 100644 --- a/common_smp/src/txe_event_flags_get.c +++ b/common_smp/src/txe_event_flags_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -31,59 +31,61 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the event flags get function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* requested_event_flags Event flags requested */ -/* get_option Specifies and/or and clear options*/ -/* actual_flags_ptr Pointer to place the actual flags */ -/* the service retrieved */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_GROUP_ERROR Invalid event flags group pointer */ -/* TX_PTR_ERROR Invalid actual flags pointer */ -/* TX_WAIT_ERROR Invalid wait option */ -/* TX_OPTION_ERROR Invalid get option */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_get Actual event flags get function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the event flags get function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* requested_event_flags Event flags requested */ +/* get_option Specifies and/or and clear options*/ +/* actual_flags_ptr Pointer to place the actual flags */ +/* the service retrieved */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_GROUP_ERROR Invalid event flags group pointer */ +/* TX_PTR_ERROR Invalid actual flags pointer */ +/* TX_WAIT_ERROR Invalid wait option */ +/* TX_OPTION_ERROR Invalid get option */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_get Actual event flags get function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; @@ -100,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) { @@ -119,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) { @@ -134,7 +136,7 @@ TX_THREAD *current_thread; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(current_thread) @@ -153,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_smp/src/txe_event_flags_info_get.c b/common_smp/src/txe_event_flags_info_get.c index 49080b0f..b5268e2e 100644 --- a/common_smp/src/txe_event_flags_info_get.c +++ b/common_smp/src/txe_event_flags_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -29,57 +29,59 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the event flag information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to event flag group */ -/* name Destination for the event flags */ -/* group name */ -/* current_flags Current event flags */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on event flags */ -/* suspended_count Destination for suspended count */ -/* next_group Destination for pointer to next */ -/* event flag group on the created */ -/* list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_GROUP_ERROR Invalid event flag group pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_info_get Actual event flags group info */ -/* get service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the event flag information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to event flag group */ +/* name Destination for the event flags */ +/* group name */ +/* current_flags Current event flags */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on event flags */ +/* suspended_count Destination for suspended count */ +/* next_group Destination for pointer to next */ +/* event flag group on the created */ +/* list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_GROUP_ERROR Invalid event flag group pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_info_get Actual event flags group info */ +/* get service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -93,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) { @@ -105,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_smp/src/txe_event_flags_set.c b/common_smp/src/txe_event_flags_set.c index 6d7e6fd7..81c39955 100644 --- a/common_smp/src/txe_event_flags_set.c +++ b/common_smp/src/txe_event_flags_set.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -29,53 +29,55 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_set PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_set PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the set event flags function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block */ -/* flags_to_set Event flags to set */ -/* set_option Specified either AND or OR */ -/* operation on the event flags */ -/* */ -/* OUTPUT */ -/* */ -/* TX_GROUP_ERROR Invalid event flags group pointer */ -/* TX_OPTION_ERROR Invalid set option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_set Actual set event flags function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the set event flags function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block */ +/* flags_to_set Event flags to set */ +/* set_option Specified either AND or OR */ +/* operation on the event flags */ +/* */ +/* OUTPUT */ +/* */ +/* TX_GROUP_ERROR Invalid event flags group pointer */ +/* TX_OPTION_ERROR Invalid set option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_set Actual set event flags function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option) { -UINT status; +UINT status; /* Default status to success. */ @@ -88,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) { @@ -105,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_smp/src/txe_event_flags_set_notify.c b/common_smp/src/txe_event_flags_set_notify.c index 8b7a1e10..b0f4357a 100644 --- a/common_smp/src/txe_event_flags_set_notify.c +++ b/common_smp/src/txe_event_flags_set_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Event Flags */ /** */ @@ -29,45 +29,47 @@ #include "tx_event_flags.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_event_flags_set_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_event_flags_set_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the event flags set notify */ -/* callback function call. */ -/* */ -/* INPUT */ -/* */ -/* group_ptr Pointer to group control block*/ -/* group_put_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_event_flags_set_notify Actual event flags set notify */ -/* call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the event flags set notify */ +/* callback function call. */ +/* */ +/* INPUT */ +/* */ +/* group_ptr Pointer to group control block*/ +/* group_put_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_event_flags_set_notify Actual event flags set notify */ +/* call */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)) @@ -83,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_smp/src/txe_mutex_create.c b/common_smp/src/txe_mutex_create.c index e99713d8..57c104e7 100644 --- a/common_smp/src/txe_mutex_create.c +++ b/common_smp/src/txe_mutex_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -32,49 +32,51 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_mutex_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_mutex_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the create mutex function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* name_ptr Pointer to mutex name */ -/* inherit Initial mutex count */ +/* */ +/* This function checks for errors in the create mutex function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* name_ptr Pointer to mutex name */ +/* inherit Initial mutex count */ /* mutex_control_block_size Size of mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_MUTEX_ERROR Invalid mutex pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* TX_INHERIT_ERROR Invalid inherit option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_create Actual create mutex function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_MUTEX_ERROR Invalid mutex pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* TX_INHERIT_ERROR Invalid inherit option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_create Actual create mutex function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size) @@ -82,7 +84,7 @@ UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_MUTEX *next_mutex; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -100,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))) { @@ -144,7 +146,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -160,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; } @@ -196,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_smp/src/txe_mutex_delete.c b/common_smp/src/txe_mutex_delete.c index 64b8a471..0b7ab706 100644 --- a/common_smp/src/txe_mutex_delete.c +++ b/common_smp/src/txe_mutex_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,61 +31,63 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_mutex_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_mutex_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the mutex delete function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_MUTEX_ERROR Invalid mutex pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_delete Actual delete mutex function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the mutex delete function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_MUTEX_ERROR Invalid mutex pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_delete Actual delete mutex function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif -#ifndef TX_TIMER_PROCESS_IN_ISR +#ifndef TX_TIMER_PROCESS_IN_ISR /* Default status to success. */ status = TX_SUCCESS; #endif - + /* Check for an invalid mutex pointer. */ if (mutex_ptr == TX_NULL) { @@ -93,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) { @@ -129,7 +131,7 @@ TX_THREAD *thread_ptr; /* Determine if everything is okay. */ if (status == TX_SUCCESS) - { + { #endif /* Call actual mutex delete function. */ diff --git a/common_smp/src/txe_mutex_get.c b/common_smp/src/txe_mutex_get.c index 752da15f..dd660009 100644 --- a/common_smp/src/txe_mutex_get.c +++ b/common_smp/src/txe_mutex_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -34,50 +34,52 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_mutex_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_mutex_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the mutex get function call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_MUTEX_ERROR Invalid mutex pointer */ -/* TX_WAIT_ERROR Invalid wait option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_get Actual get mutex function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the mutex get function call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_MUTEX_ERROR Invalid mutex pointer */ +/* TX_WAIT_ERROR Invalid wait option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_get Actual get mutex function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; #endif @@ -93,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) { @@ -104,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) { @@ -143,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_smp/src/txe_mutex_info_get.c b/common_smp/src/txe_mutex_info_get.c index b093db78..69e3c814 100644 --- a/common_smp/src/txe_mutex_info_get.c +++ b/common_smp/src/txe_mutex_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -29,56 +29,58 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_mutex_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_mutex_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the mutex information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* name Destination for the mutex name */ -/* count Destination for the owner count */ -/* owner Destination for the owner's */ -/* thread control block pointer */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on the mutex */ -/* suspended_count Destination for suspended count */ -/* next_mutex Destination for pointer to next */ -/* mutex on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_MUTEX_ERROR Invalid mutex pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_info_get Actual mutex info get service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the mutex information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* name Destination for the mutex name */ +/* count Destination for the owner count */ +/* owner Destination for the owner's */ +/* thread control block pointer */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on the mutex */ +/* suspended_count Destination for suspended count */ +/* next_mutex Destination for pointer to next */ +/* mutex on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_MUTEX_ERROR Invalid mutex pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_info_get Actual mutex info get service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, - TX_THREAD **first_suspended, ULONG *suspended_count, + TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex) { @@ -92,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) { @@ -104,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_smp/src/txe_mutex_prioritize.c b/common_smp/src/txe_mutex_prioritize.c index 7fa7706e..679e3ac8 100644 --- a/common_smp/src/txe_mutex_prioritize.c +++ b/common_smp/src/txe_mutex_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -29,42 +29,44 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_mutex_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_mutex_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the mutex prioritize call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_prioritize Actual mutex prioritize */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the mutex prioritize call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_prioritize Actual mutex prioritize */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr) @@ -80,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_smp/src/txe_mutex_put.c b/common_smp/src/txe_mutex_put.c index 12266f48..7a6fdffc 100644 --- a/common_smp/src/txe_mutex_put.c +++ b/common_smp/src/txe_mutex_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Mutex */ /** */ @@ -31,48 +31,50 @@ #include "tx_mutex.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_mutex_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_mutex_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the mutex put function call. */ -/* */ -/* INPUT */ -/* */ -/* mutex_ptr Pointer to mutex control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_MUTEX_ERROR Invalid mutex pointer */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_mutex_put Actual put mutex function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the mutex put function call. */ +/* */ +/* INPUT */ +/* */ +/* mutex_ptr Pointer to mutex control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_MUTEX_ERROR Invalid mutex pointer */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_mutex_put Actual put mutex function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_mutex_put(TX_MUTEX *mutex_ptr) { -UINT status; +UINT status; /* Default status to success. */ @@ -85,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) { @@ -97,13 +99,13 @@ UINT status; { /* Check for interrupt call. */ - if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0)) + 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_smp/src/txe_queue_create.c b/common_smp/src/txe_queue_create.c index b3b2021f..592d0a89 100644 --- a/common_smp/src/txe_queue_create.c +++ b/common_smp/src/txe_queue_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -32,59 +32,61 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue create function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* name_ptr Pointer to queue name */ -/* message_size Size of each queue message */ -/* queue_start Starting address of the queue area*/ -/* queue_size Number of bytes in the queue */ +/* */ +/* This function checks for errors in the queue create function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* name_ptr Pointer to queue name */ +/* message_size Size of each queue message */ +/* queue_start Starting address of the queue area*/ +/* queue_size Number of bytes in the queue */ /* queue_control_block_size Size of queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_PTR_ERROR Invalid starting address of queue */ -/* TX_SIZE_ERROR Invalid message queue size */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_create Actual queue create function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_PTR_ERROR Invalid starting address of queue */ +/* TX_SIZE_ERROR Invalid message queue size */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_create Actual queue create function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_QUEUE *next_queue; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -102,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))) { @@ -135,7 +137,7 @@ TX_THREAD *thread_ptr; } else { - + /* Move to the next queue. */ next_queue = next_queue -> tx_queue_created_next; } @@ -146,7 +148,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -176,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) { @@ -212,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_smp/src/txe_queue_delete.c b/common_smp/src/txe_queue_delete.c index 75ba2ee0..b61b923f 100644 --- a/common_smp/src/txe_queue_delete.c +++ b/common_smp/src/txe_queue_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,49 +31,51 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue delete function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_delete Actual queue delete function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue delete function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_delete Actual queue delete function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_delete(TX_QUEUE *queue_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -99,7 +101,7 @@ TX_THREAD *thread_ptr; } else { - + /* Check for invalid caller of this function. */ /* Is the caller an ISR or Initialization? */ @@ -113,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_smp/src/txe_queue_flush.c b/common_smp/src/txe_queue_flush.c index e0eaeee7..611b7b51 100644 --- a/common_smp/src/txe_queue_flush.c +++ b/common_smp/src/txe_queue_flush.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -29,43 +29,45 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_flush PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_flush PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue flush function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_flush Actual queue flush function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue flush function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_flush Actual queue flush function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_flush(TX_QUEUE *queue_ptr) @@ -81,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_smp/src/txe_queue_front_send.c b/common_smp/src/txe_queue_front_send.c index 2a4332d2..ae38162f 100644 --- a/common_smp/src/txe_queue_front_send.c +++ b/common_smp/src/txe_queue_front_send.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,52 +31,54 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_front_send PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_front_send PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue send function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* source_ptr Pointer to message source */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_PTR_ERROR Invalid source pointer - NULL */ -/* TX_WAIT_ERROR Invalid wait option - non thread */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_front_send Actual queue send function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue send function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* source_ptr Pointer to message source */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_PTR_ERROR Invalid source pointer - NULL */ +/* TX_WAIT_ERROR Invalid wait option - non thread */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_front_send Actual queue send function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; @@ -112,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) { @@ -124,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_smp/src/txe_queue_info_get.c b/common_smp/src/txe_queue_info_get.c index 286cbd75..f60e3d97 100644 --- a/common_smp/src/txe_queue_info_get.c +++ b/common_smp/src/txe_queue_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -29,51 +29,53 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* name Destination for the queue name */ -/* enqueued Destination for enqueued count */ -/* available_storage Destination for available storage */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on this queue */ -/* suspended_count Destination for suspended count */ -/* next_queue Destination for pointer to next */ -/* queue on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_info_get Actual information get service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* name Destination for the queue name */ +/* enqueued Destination for enqueued count */ +/* available_storage Destination for available storage */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on this queue */ +/* suspended_count Destination for suspended count */ +/* next_queue Destination for pointer to next */ +/* queue on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_info_get Actual information get service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage, @@ -90,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) { @@ -102,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_smp/src/txe_queue_prioritize.c b/common_smp/src/txe_queue_prioritize.c index 947ac49e..ca91c762 100644 --- a/common_smp/src/txe_queue_prioritize.c +++ b/common_smp/src/txe_queue_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -29,41 +29,43 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue prioritize call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_prioritize Actual queue prioritize function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue prioritize call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_prioritize Actual queue prioritize function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_prioritize(TX_QUEUE *queue_ptr) diff --git a/common_smp/src/txe_queue_receive.c b/common_smp/src/txe_queue_receive.c index ecd02878..d00e6b94 100644 --- a/common_smp/src/txe_queue_receive.c +++ b/common_smp/src/txe_queue_receive.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,54 +31,56 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_receive PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_receive PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue receive function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* destination_ptr Pointer to message destination */ -/* **** MUST BE LARGE ENOUGH TO */ -/* HOLD MESSAGE **** */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_PTR_ERROR Invalid destination pointer (NULL)*/ -/* TX_WAIT_ERROR Invalid wait option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_receive Actual queue receive function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue receive function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* destination_ptr Pointer to message destination */ +/* **** MUST BE LARGE ENOUGH TO */ +/* HOLD MESSAGE **** */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_PTR_ERROR Invalid destination pointer (NULL)*/ +/* TX_WAIT_ERROR Invalid wait option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_receive Actual queue receive function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; @@ -95,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) { @@ -114,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) { @@ -126,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_smp/src/txe_queue_send.c b/common_smp/src/txe_queue_send.c index 5f07af11..03a6f866 100644 --- a/common_smp/src/txe_queue_send.c +++ b/common_smp/src/txe_queue_send.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -31,52 +31,54 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_send PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_send PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue send function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block */ -/* source_ptr Pointer to message source */ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_QUEUE_ERROR Invalid queue pointer */ -/* TX_PTR_ERROR Invalid source pointer - NULL */ -/* TX_WAIT_ERROR Invalid wait option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_send Actual queue send function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue send function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block */ +/* source_ptr Pointer to message source */ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_QUEUE_ERROR Invalid queue pointer */ +/* TX_PTR_ERROR Invalid source pointer - NULL */ +/* TX_WAIT_ERROR Invalid wait option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_send Actual queue send function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; @@ -93,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) { @@ -112,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) { @@ -124,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_smp/src/txe_queue_send_notify.c b/common_smp/src/txe_queue_send_notify.c index 0716470a..b90ff386 100644 --- a/common_smp/src/txe_queue_send_notify.c +++ b/common_smp/src/txe_queue_send_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Queue */ /** */ @@ -29,44 +29,46 @@ #include "tx_queue.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_queue_send_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_queue_send_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the queue send notify */ -/* callback function call. */ -/* */ -/* INPUT */ -/* */ -/* queue_ptr Pointer to queue control block*/ -/* queue_send_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_queue_send_notify Actual queue send notify call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the queue send notify */ +/* callback function call. */ +/* */ +/* INPUT */ +/* */ +/* queue_ptr Pointer to queue control block*/ +/* queue_send_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_queue_send_notify Actual queue send notify call */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)) diff --git a/common_smp/src/txe_semaphore_ceiling_put.c b/common_smp/src/txe_semaphore_ceiling_put.c index 86f052f0..7aafcd23 100644 --- a/common_smp/src/txe_semaphore_ceiling_put.c +++ b/common_smp/src/txe_semaphore_ceiling_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -29,52 +29,54 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_ceiling_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_ceiling_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore ceiling put */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore */ -/* ceiling Maximum value of semaphore */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* TX_INVALID_CEILING Invalid semaphore ceiling */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_ceiling_put Actual semaphore ceiling put */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore ceiling put */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore */ +/* ceiling Maximum value of semaphore */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* TX_INVALID_CEILING Invalid semaphore ceiling */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_ceiling_put Actual semaphore ceiling put */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling) { -UINT status; +UINT status; /* Check for an invalid semaphore pointer. */ @@ -84,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_smp/src/txe_semaphore_create.c b/common_smp/src/txe_semaphore_create.c index d8d306bc..84a047a8 100644 --- a/common_smp/src/txe_semaphore_create.c +++ b/common_smp/src/txe_semaphore_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -32,48 +32,50 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the create semaphore function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* name_ptr Pointer to semaphore name */ -/* initial_count Initial semaphore count */ +/* */ +/* This function checks for errors in the create semaphore function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* name_ptr Pointer to semaphore name */ +/* initial_count Initial semaphore count */ /* semaphore_control_block_size Size of semaphore control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_create Actual create semaphore function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_create Actual create semaphore function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size) @@ -81,7 +83,7 @@ UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG i TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_SEMAPHORE *next_semaphore; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -127,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; } @@ -143,7 +145,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -161,7 +163,7 @@ TX_THREAD *thread_ptr; #ifndef TX_TIMER_PROCESS_IN_ISR else { - + /* Pickup thread pointer. */ TX_THREAD_GET_CURRENT(thread_ptr) @@ -183,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_smp/src/txe_semaphore_delete.c b/common_smp/src/txe_semaphore_delete.c index 7436c8e1..5727119f 100644 --- a/common_smp/src/txe_semaphore_delete.c +++ b/common_smp/src/txe_semaphore_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,50 +31,52 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore delete function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_delete Actual delete semaphore function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore delete function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_delete Actual delete semaphore function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *thread_ptr; #endif @@ -114,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_smp/src/txe_semaphore_get.c b/common_smp/src/txe_semaphore_get.c index 03dd492f..f5d1209c 100644 --- a/common_smp/src/txe_semaphore_get.c +++ b/common_smp/src/txe_semaphore_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -31,50 +31,52 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore get function call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* wait_option Suspension option */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* TX_WAIT_ERROR Invalid wait option */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_get Actual get semaphore function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore get function call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* wait_option Suspension option */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* TX_WAIT_ERROR Invalid wait option */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_get Actual get semaphore function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option) { -UINT status; +UINT status; #ifndef TX_TIMER_PROCESS_IN_ISR TX_THREAD *current_thread; @@ -91,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) { @@ -102,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) { @@ -114,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_smp/src/txe_semaphore_info_get.c b/common_smp/src/txe_semaphore_info_get.c index c3fac5fd..7789ea9f 100644 --- a/common_smp/src/txe_semaphore_info_get.c +++ b/common_smp/src/txe_semaphore_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -29,55 +29,57 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* name Destination for the semaphore name*/ -/* current_value Destination for current value of */ -/* the semaphore */ -/* first_suspended Destination for pointer of first */ -/* thread suspended on semaphore */ -/* suspended_count Destination for suspended count */ -/* next_semaphore Destination for pointer to next */ -/* semaphore on the created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_info_get Actual semaphore info get service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* name Destination for the semaphore name*/ +/* current_value Destination for current value of */ +/* the semaphore */ +/* first_suspended Destination for pointer of first */ +/* thread suspended on semaphore */ +/* suspended_count Destination for suspended count */ +/* next_semaphore Destination for pointer to next */ +/* semaphore on the created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_info_get Actual semaphore info get service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -91,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) { @@ -103,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_smp/src/txe_semaphore_prioritize.c b/common_smp/src/txe_semaphore_prioritize.c index d8fea7e4..b00c82d4 100644 --- a/common_smp/src/txe_semaphore_prioritize.c +++ b/common_smp/src/txe_semaphore_prioritize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -29,42 +29,44 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _tx_semaphore_prioritize PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_semaphore_prioritize PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore prioritize call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_prioritize Actual semaphore prioritize */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore prioritize call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_prioritize Actual semaphore prioritize */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr) @@ -80,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_smp/src/txe_semaphore_put.c b/common_smp/src/txe_semaphore_put.c index 04679cc0..591026ed 100644 --- a/common_smp/src/txe_semaphore_put.c +++ b/common_smp/src/txe_semaphore_put.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -29,48 +29,50 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_put PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_put PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore put function call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore control block*/ -/* */ -/* OUTPUT */ -/* */ -/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_put Actual put semaphore function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore put function call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore control block*/ +/* */ +/* OUTPUT */ +/* */ +/* TX_SEMAPHORE_ERROR Invalid semaphore pointer */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_put Actual put semaphore function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr) { -UINT status; +UINT status; /* Check for an invalid semaphore pointer. */ @@ -80,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_smp/src/txe_semaphore_put_notify.c b/common_smp/src/txe_semaphore_put_notify.c index b8198270..f73e1f99 100644 --- a/common_smp/src/txe_semaphore_put_notify.c +++ b/common_smp/src/txe_semaphore_put_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Semaphore */ /** */ @@ -29,45 +29,47 @@ #include "tx_semaphore.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_semaphore_put_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_semaphore_put_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the semaphore put notify */ -/* callback function call. */ -/* */ -/* INPUT */ -/* */ -/* semaphore_ptr Pointer to semaphore */ -/* semaphore_put_notify Application callback function */ -/* (TX_NULL disables notify) */ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_semaphore_put_notify Actual semaphore put notify */ -/* call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the semaphore put notify */ +/* callback function call. */ +/* */ +/* INPUT */ +/* */ +/* semaphore_ptr Pointer to semaphore */ +/* semaphore_put_notify Application callback function */ +/* (TX_NULL disables notify) */ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_semaphore_put_notify Actual semaphore put notify */ +/* call */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)) @@ -83,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_smp/src/txe_thread_create.c b/common_smp/src/txe_thread_create.c index 40e1b0dd..75f5e660 100644 --- a/common_smp/src/txe_thread_create.c +++ b/common_smp/src/txe_thread_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -31,63 +31,65 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread create function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Thread control block pointer */ -/* name Pointer to thread name string */ -/* entry_function Entry function of the thread */ -/* entry_input 32-bit input value to thread */ -/* stack_start Pointer to start of stack */ -/* stack_size Stack size in bytes */ -/* priority Priority of thread (0-31) */ +/* */ +/* This function checks for errors in the thread create function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Thread control block pointer */ +/* name Pointer to thread name string */ +/* entry_function Entry function of the thread */ +/* entry_input 32-bit input value to thread */ +/* stack_start Pointer to start of stack */ +/* stack_size Stack size in bytes */ +/* priority Priority of thread (0-31) */ /* preempt_threshold Preemption threshold */ -/* time_slice Thread time-slice value */ -/* auto_start Automatic start selection */ +/* time_slice Thread time-slice value */ +/* auto_start Automatic start selection */ /* thread_control_block_size Size of thread control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_PTR_ERROR Invalid entry point or stack */ -/* address */ -/* TX_SIZE_ERROR Invalid stack size -too small */ -/* TX_PRIORITY_ERROR Invalid thread priority */ -/* TX_THRESH_ERROR Invalid preemption threshold */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_create Actual thread create function */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_PTR_ERROR Invalid entry point or stack */ +/* address */ +/* TX_SIZE_ERROR Invalid stack size -too small */ +/* TX_PRIORITY_ERROR Invalid thread priority */ +/* TX_THRESH_ERROR Invalid preemption threshold */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_create Actual thread create function */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -143,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; } @@ -166,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; } @@ -182,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; } @@ -201,7 +203,7 @@ TX_THREAD *current_thread; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -283,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_smp/src/txe_thread_delete.c b/common_smp/src/txe_thread_delete.c index 4c7a1b04..55b98abe 100644 --- a/common_smp/src/txe_thread_delete.c +++ b/common_smp/src/txe_thread_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,43 +29,45 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread delete function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_delete Actual thread delete function */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread delete function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_delete Actual thread delete function */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_delete(TX_THREAD *thread_ptr) diff --git a/common_smp/src/txe_thread_entry_exit_notify.c b/common_smp/src/txe_thread_entry_exit_notify.c index 061f77c3..0dec7dba 100644 --- a/common_smp/src/txe_thread_entry_exit_notify.c +++ b/common_smp/src/txe_thread_entry_exit_notify.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,45 +29,47 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_entry_exit_notify PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_entry_exit_notify PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread entry/exit notify */ -/* callback function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* thread_entry_exit_notify Pointer to notify callback */ -/* function, TX_NULL to disable*/ -/* */ -/* OUTPUT */ -/* */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_entry_exit_notify Actual entry/exit notify */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread entry/exit notify */ +/* callback function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* thread_entry_exit_notify Pointer to notify callback */ +/* function, TX_NULL to disable*/ +/* */ +/* OUTPUT */ +/* */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_entry_exit_notify Actual entry/exit notify */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)) @@ -83,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_smp/src/txe_thread_info_get.c b/common_smp/src/txe_thread_info_get.c index ba8f5acf..6d0e594f 100644 --- a/common_smp/src/txe_thread_info_get.c +++ b/common_smp/src/txe_thread_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,59 +29,61 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread control block */ -/* name Destination for the thread name */ -/* state Destination for thread state */ -/* run_count Destination for thread run count */ -/* priority Destination for thread priority */ -/* preemption_threshold Destination for thread preemption-*/ -/* threshold */ -/* time_slice Destination for thread time-slice */ -/* next_thread Destination for next created */ -/* thread */ -/* next_suspended_thread Destination for next suspended */ -/* thread */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_info_get Actual thread information get */ -/* service */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread control block */ +/* name Destination for the thread name */ +/* state Destination for thread state */ +/* run_count Destination for thread run count */ +/* priority Destination for thread priority */ +/* preemption_threshold Destination for thread preemption-*/ +/* threshold */ +/* time_slice Destination for thread time-slice */ +/* next_thread Destination for next created */ +/* thread */ +/* next_suspended_thread Destination for next suspended */ +/* thread */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_info_get Actual thread information get */ +/* service */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -95,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) { @@ -107,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_smp/src/txe_thread_preemption_change.c b/common_smp/src/txe_thread_preemption_change.c index a10244d3..8cfee279 100644 --- a/common_smp/src/txe_thread_preemption_change.c +++ b/common_smp/src/txe_thread_preemption_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,47 +29,49 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_preemption_change PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_preemption_change PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the preemption threshold change */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* new_threshold New preemption threshold */ -/* old_threshold Old preemption threshold */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_PTR_ERROR Invalid old threshold pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_preemption_change Actual preempt change function*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the preemption threshold change */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* new_threshold New preemption threshold */ +/* old_threshold Old preemption threshold */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_PTR_ERROR Invalid old threshold pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_preemption_change Actual preempt change function*/ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, UINT *old_threshold) @@ -85,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_smp/src/txe_thread_priority_change.c b/common_smp/src/txe_thread_priority_change.c index 6b7445cf..fcccbc43 100644 --- a/common_smp/src/txe_thread_priority_change.c +++ b/common_smp/src/txe_thread_priority_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,48 +29,50 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_priority_change PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_priority_change PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the change priority function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* new_priority New thread priority */ -/* old_priority Old thread priority */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_PTR_ERROR Invalid old priority pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_priority_change Actual priority change */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the change priority function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* new_priority New thread priority */ +/* old_priority Old thread priority */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_PTR_ERROR Invalid old priority pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_priority_change Actual priority change */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority, UINT *old_priority) @@ -86,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) { @@ -106,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_smp/src/txe_thread_relinquish.c b/common_smp/src/txe_thread_relinquish.c index 378f122c..f0a6ea83 100644 --- a/common_smp/src/txe_thread_relinquish.c +++ b/common_smp/src/txe_thread_relinquish.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,42 +29,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_relinquish PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_relinquish PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks to make sure a thread is executing before the */ -/* relinquish is executed. */ -/* */ -/* INPUT */ -/* */ -/* None */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_relinquish Actual thread relinquish call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks to make sure a thread is executing before the */ +/* relinquish is executed. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_relinquish Actual thread relinquish call */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ VOID _txe_thread_relinquish(VOID) @@ -83,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_smp/src/txe_thread_reset.c b/common_smp/src/txe_thread_reset.c index 544e45f8..18f962ac 100644 --- a/common_smp/src/txe_thread_reset.c +++ b/common_smp/src/txe_thread_reset.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -30,43 +30,45 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_reset PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_reset PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread reset function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to reset */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Service return status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_reset Actual thread reset function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread reset function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to reset */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Service return status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_reset Actual thread reset function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_reset(TX_THREAD *thread_ptr) @@ -88,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) { @@ -116,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_smp/src/txe_thread_resume.c b/common_smp/src/txe_thread_resume.c index 2028e43a..33a9abe9 100644 --- a/common_smp/src/txe_thread_resume.c +++ b/common_smp/src/txe_thread_resume.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,42 +29,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_resume PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_resume PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the resume thread function call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to resume */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_resume Actual thread resume function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the resume thread function call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to resume */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_resume Actual thread resume function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_resume(TX_THREAD *thread_ptr) @@ -80,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_smp/src/txe_thread_suspend.c b/common_smp/src/txe_thread_suspend.c index a673d891..f368d4ea 100644 --- a/common_smp/src/txe_thread_suspend.c +++ b/common_smp/src/txe_thread_suspend.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,44 +29,46 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_suspend PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_suspend PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread suspend function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_suspend Actual thread suspension */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread suspend function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_suspend Actual thread suspension */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_suspend(TX_THREAD *thread_ptr) diff --git a/common_smp/src/txe_thread_terminate.c b/common_smp/src/txe_thread_terminate.c index f5c08ce6..0865c677 100644 --- a/common_smp/src/txe_thread_terminate.c +++ b/common_smp/src/txe_thread_terminate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,45 +29,47 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_terminate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_terminate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread terminate function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread to suspend */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_terminate Actual thread terminate */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread terminate function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread to suspend */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_terminate Actual thread terminate */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_terminate(TX_THREAD *thread_ptr) @@ -83,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_smp/src/txe_thread_time_slice_change.c b/common_smp/src/txe_thread_time_slice_change.c index f124b3f9..be68afb3 100644 --- a/common_smp/src/txe_thread_time_slice_change.c +++ b/common_smp/src/txe_thread_time_slice_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,47 +29,49 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_time_slice_change PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_time_slice_change PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the time slice change function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Pointer to thread */ -/* new_time_slice New time slice */ -/* old_time_slice Old time slice */ -/* */ -/* OUTPUT */ -/* */ -/* TX_THREAD_ERROR Invalid thread pointer */ -/* TX_CALLER_ERROR Invalid caller of function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_time_slice_change Actual time-slice change */ -/* function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the time slice change function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Pointer to thread */ +/* new_time_slice New time slice */ +/* old_time_slice Old time slice */ +/* */ +/* OUTPUT */ +/* */ +/* TX_THREAD_ERROR Invalid thread pointer */ +/* TX_CALLER_ERROR Invalid caller of function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_time_slice_change Actual time-slice change */ +/* function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice) @@ -85,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_smp/src/txe_thread_wait_abort.c b/common_smp/src/txe_thread_wait_abort.c index 14dc5fe3..9482e809 100644 --- a/common_smp/src/txe_thread_wait_abort.c +++ b/common_smp/src/txe_thread_wait_abort.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Thread */ /** */ @@ -29,42 +29,44 @@ #include "tx_thread.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_thread_wait_abort PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_thread_wait_abort PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the thread wait abort function */ -/* call. */ -/* */ -/* INPUT */ -/* */ -/* thread_ptr Thread to abort the wait on */ -/* */ -/* OUTPUT */ -/* */ -/* status Return completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_wait_abort Actual wait abort function */ -/* */ -/* CALLED BY */ -/* */ -/* Application code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the thread wait abort function */ +/* call. */ +/* */ +/* INPUT */ +/* */ +/* thread_ptr Thread to abort the wait on */ +/* */ +/* OUTPUT */ +/* */ +/* status Return completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_wait_abort Actual wait abort function */ +/* */ +/* CALLED BY */ +/* */ +/* Application code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr) @@ -80,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_smp/src/txe_timer_activate.c b/common_smp/src/txe_timer_activate.c index d3186f3d..9a50e39e 100644 --- a/common_smp/src/txe_timer_activate.c +++ b/common_smp/src/txe_timer_activate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -29,44 +29,46 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_activate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_activate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the activate application timer */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid application timer */ -/* TX_ACTIVATE_ERROR Application timer already active */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_activate Actual application timer activate */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the activate application timer */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid application timer */ +/* TX_ACTIVATE_ERROR Application timer already active */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_activate Actual application timer activate */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_timer_activate(TX_TIMER *timer_ptr) @@ -81,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_smp/src/txe_timer_change.c b/common_smp/src/txe_timer_change.c index d3a1eb17..d6db7755 100644 --- a/common_smp/src/txe_timer_change.c +++ b/common_smp/src/txe_timer_change.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -31,53 +31,55 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_change PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_change PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the application timer change */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* initial_ticks Initial expiration ticks */ -/* reschedule_ticks Reschedule ticks */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid application timer pointer */ -/* TX_TICK_ERROR Invalid initial tick value of 0 */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_change Actual timer change function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the application timer change */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* initial_ticks Initial expiration ticks */ +/* reschedule_ticks Reschedule ticks */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid application timer pointer */ +/* TX_TICK_ERROR Invalid initial tick value of 0 */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_change Actual timer change function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks) { -UINT status; +UINT status; /* Check for an invalid timer pointer. */ @@ -87,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) { @@ -117,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_smp/src/txe_timer_create.c b/common_smp/src/txe_timer_create.c index 08352974..de08c053 100644 --- a/common_smp/src/txe_timer_create.c +++ b/common_smp/src/txe_timer_create.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -31,63 +31,65 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_create PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the create application timer */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* name_ptr Pointer to timer name */ -/* expiration_function Application expiration function */ -/* initial_ticks Initial expiration ticks */ -/* reschedule_ticks Reschedule ticks */ -/* auto_activate Automatic activation flag */ +/* */ +/* This function checks for errors in the create application timer */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* name_ptr Pointer to timer name */ +/* expiration_function Application expiration function */ +/* initial_ticks Initial expiration ticks */ +/* reschedule_ticks Reschedule ticks */ +/* auto_activate Automatic activation flag */ /* timer_control_block_size Size of timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid timer control block */ -/* TX_TICK_ERROR Invalid initial expiration count */ -/* TX_ACTIVATE_ERROR Invalid timer activation option */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_thread_system_preempt_check Check for preemption */ -/* _tx_timer_create Actual timer create function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid timer control block */ +/* TX_TICK_ERROR Invalid initial expiration count */ +/* TX_ACTIVATE_ERROR Invalid timer activation option */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_thread_system_preempt_check Check for preemption */ +/* _tx_timer_create Actual timer create function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { TX_INTERRUPT_SAVE_AREA -UINT status; +UINT status; ULONG i; TX_TIMER *next_timer; #ifndef TX_TIMER_PROCESS_IN_ISR @@ -105,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))) { @@ -133,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; } @@ -149,7 +151,7 @@ TX_THREAD *thread_ptr; /* Decrement the preempt disable flag. */ _tx_thread_preempt_disable--; - + /* Restore interrupts. */ TX_RESTORE @@ -177,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; } @@ -210,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_smp/src/txe_timer_deactivate.c b/common_smp/src/txe_timer_deactivate.c index 58c66d81..d5379001 100644 --- a/common_smp/src/txe_timer_deactivate.c +++ b/common_smp/src/txe_timer_deactivate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -29,49 +29,51 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_deactivate PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_deactivate PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the deactivate application timer */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid application timer pointer */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_deactivate Actual timer deactivation function*/ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the deactivate application timer */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid application timer pointer */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_deactivate Actual timer deactivation function*/ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_timer_deactivate(TX_TIMER *timer_ptr) { -UINT status; +UINT status; /* Check for an invalid timer pointer. */ @@ -91,7 +93,7 @@ UINT status; } else { - + /* Call actual application timer deactivate function. */ status = _tx_timer_deactivate(timer_ptr); } diff --git a/common_smp/src/txe_timer_delete.c b/common_smp/src/txe_timer_delete.c index aee1b34c..0502efd2 100644 --- a/common_smp/src/txe_timer_delete.c +++ b/common_smp/src/txe_timer_delete.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -30,44 +30,46 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_delete PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_delete PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the delete application timer */ -/* function call. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid application timer pointer */ -/* TX_CALLER_ERROR Invalid caller of this function */ -/* status Actual completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_delete Actual timer delete function */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the delete application timer */ +/* function call. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid application timer pointer */ +/* TX_CALLER_ERROR Invalid caller of this function */ +/* status Actual completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_delete Actual timer delete function */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _txe_timer_delete(TX_TIMER *timer_ptr) @@ -84,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) { @@ -119,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_smp/src/txe_timer_info_get.c b/common_smp/src/txe_timer_info_get.c index a53a7885..b2865983 100644 --- a/common_smp/src/txe_timer_info_get.c +++ b/common_smp/src/txe_timer_info_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** ThreadX Component */ +/** */ +/** ThreadX Component */ /** */ /** Timer */ /** */ @@ -29,53 +29,55 @@ #include "tx_timer.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _txe_timer_info_get PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _txe_timer_info_get PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function checks for errors in the timer information get */ -/* service. */ -/* */ -/* INPUT */ -/* */ -/* timer_ptr Pointer to timer control block */ -/* name Destination for the timer name */ -/* active Destination for active flag */ -/* remaining_ticks Destination for remaining ticks */ -/* before expiration */ -/* reschedule_ticks Destination for reschedule ticks */ -/* next_timer Destination for next timer on the */ -/* created list */ -/* */ -/* OUTPUT */ -/* */ -/* TX_TIMER_ERROR Invalid timer pointer */ -/* status Completion status */ -/* */ -/* CALLS */ -/* */ -/* _tx_timer_info_get Actual info get call */ -/* */ -/* CALLED BY */ -/* */ -/* Application Code */ -/* */ -/* RELEASE HISTORY */ -/* */ +/* */ +/* This function checks for errors in the timer information get */ +/* service. */ +/* */ +/* INPUT */ +/* */ +/* timer_ptr Pointer to timer control block */ +/* name Destination for the timer name */ +/* active Destination for active flag */ +/* remaining_ticks Destination for remaining ticks */ +/* before expiration */ +/* reschedule_ticks Destination for reschedule ticks */ +/* next_timer Destination for next timer on the */ +/* created list */ +/* */ +/* OUTPUT */ +/* */ +/* TX_TIMER_ERROR Invalid timer pointer */ +/* status Completion status */ +/* */ +/* CALLS */ +/* */ +/* _tx_timer_info_get Actual info get call */ +/* */ +/* CALLED BY */ +/* */ +/* Application Code */ +/* */ +/* RELEASE HISTORY */ +/* */ /* DATE NAME DESCRIPTION */ /* */ -/* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 05-19-2020 William E. Lamie Initial Version 6.0 */ +/* 09-30-2020 Yuxin Zhou Modified comment(s), */ +/* 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) { @@ -89,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) { |
