Release 6.1.9

This commit is contained in:
Yuxin Zhou
2021-10-14 00:51:26 +00:00
parent 215df45d4b
commit 1af8404c54
1812 changed files with 60698 additions and 249862 deletions

View File

@@ -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
}