mirror of
https://github.com/eclipse-threadx/threadx.git
synced 2026-02-06 00:52:51 +08:00
Release 6.1.9
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Block Memory */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_block_pool.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_block_pool.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX block memory management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX block memory management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -54,12 +56,12 @@
|
||||
#define TX_BLOCK_POOL_ID ((ULONG) 0x424C4F43)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the block memory pool
|
||||
/* Yes, in-line initialization is supported, remap the block memory pool
|
||||
initialization function. */
|
||||
|
||||
#ifndef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
@@ -95,7 +97,7 @@ VOID _tx_block_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_seque
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_BLOCK_POOL_INIT
|
||||
#define BLOCK_POOL_DECLARE
|
||||
#define BLOCK_POOL_DECLARE
|
||||
#else
|
||||
#define BLOCK_POOL_DECLARE extern
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Byte Memory */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_byte_pool.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_byte_pool.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX byte memory management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX byte memory management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -66,12 +68,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the byte memory pool
|
||||
/* Yes, in-line initialization is supported, remap the byte memory pool
|
||||
initialization function. */
|
||||
|
||||
#ifndef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
@@ -111,7 +113,7 @@ VOID _tx_byte_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequen
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_BYTE_POOL_INIT
|
||||
#define BYTE_POOL_DECLARE
|
||||
#define BYTE_POOL_DECLARE
|
||||
#else
|
||||
#define BYTE_POOL_DECLARE extern
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Event Flags */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_event_flags.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_event_flags.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX event flags management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX event flags management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -56,11 +58,11 @@
|
||||
#define TX_EVENT_FLAGS_CLEAR_MASK ((UINT) 0x1)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the event flag initialization
|
||||
/* Yes, in-line initialization is supported, remap the event flag initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
|
||||
@@ -96,7 +98,7 @@ VOID _tx_event_flags_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequ
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_EVENT_FLAGS_INIT
|
||||
#define EVENT_FLAGS_DECLARE
|
||||
#define EVENT_FLAGS_DECLARE
|
||||
#else
|
||||
#define EVENT_FLAGS_DECLARE extern
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Initialize */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_initialize.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_initialize.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX initialization component, including */
|
||||
/* */
|
||||
/* This file defines the ThreadX initialization component, including */
|
||||
/* data types and external references. It is assumed that tx_api.h */
|
||||
/* and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -65,15 +67,15 @@ VOID _tx_initialize_low_level(VOID);
|
||||
|
||||
/* Define the macro for adding additional port-specific global data. This macro is defined
|
||||
as white space, unless defined by tx_port.h. */
|
||||
|
||||
|
||||
#ifndef TX_PORT_SPECIFIC_DATA
|
||||
#define TX_PORT_SPECIFIC_DATA
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the macro for adding additional port-specific pre and post initialization processing.
|
||||
/* Define the macro for adding additional port-specific pre and post initialization processing.
|
||||
These macros is defined as white space, unless defined by tx_port.h. */
|
||||
|
||||
|
||||
#ifndef TX_PORT_SPECIFIC_PRE_INITIALIZATION
|
||||
#define TX_PORT_SPECIFIC_PRE_INITIALIZATION
|
||||
#endif
|
||||
@@ -94,15 +96,15 @@ VOID _tx_initialize_low_level(VOID);
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_INITIALIZE_INIT
|
||||
#define INITIALIZE_DECLARE
|
||||
#define INITIALIZE_DECLARE
|
||||
#else
|
||||
#define INITIALIZE_DECLARE extern
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
memory address is placed in this variable in the low-level
|
||||
initialization function. The content of this variable is passed
|
||||
initialization function. The content of this variable is passed
|
||||
to the application's system definition function. */
|
||||
|
||||
INITIALIZE_DECLARE VOID *_tx_initialize_unused_memory;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Mutex */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_mutex.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_mutex.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX mutex management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX mutex management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -54,18 +56,18 @@
|
||||
#define TX_MUTEX_ID ((ULONG) 0x4D555445)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the mutex initialization
|
||||
/* Yes, in-line initialization is supported, remap the mutex initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_MUTEX_ENABLE_PERFORMANCE_INFO
|
||||
#define _tx_mutex_initialize() \
|
||||
_tx_mutex_created_ptr = TX_NULL; \
|
||||
_tx_mutex_created_count = TX_EMPTY
|
||||
_tx_mutex_created_count = TX_EMPTY
|
||||
#else
|
||||
#define _tx_mutex_initialize() \
|
||||
_tx_mutex_created_ptr = TX_NULL; \
|
||||
@@ -75,7 +77,7 @@
|
||||
_tx_mutex_performance_suspension_count = ((ULONG) 0); \
|
||||
_tx_mutex_performance_timeout_count = ((ULONG) 0); \
|
||||
_tx_mutex_performance_priority_inversion_count = ((ULONG) 0); \
|
||||
_tx_mutex_performance__priority_inheritance_count = ((ULONG) 0)
|
||||
_tx_mutex_performance__priority_inheritance_count = ((ULONG) 0)
|
||||
#endif
|
||||
#define TX_MUTEX_INIT
|
||||
#else
|
||||
@@ -99,7 +101,7 @@ VOID _tx_mutex_priority_change(TX_THREAD *thread_ptr, UINT new_priority);
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_MUTEX_INIT
|
||||
#define MUTEX_DECLARE
|
||||
#define MUTEX_DECLARE
|
||||
#else
|
||||
#define MUTEX_DECLARE extern
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Queue */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_queue.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_queue.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX queue management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX queue management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -54,23 +56,23 @@
|
||||
#define TX_QUEUE_ID ((ULONG) 0x51554555)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the queue initialization
|
||||
/* Yes, in-line initialization is supported, remap the queue initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
#define _tx_queue_initialize() \
|
||||
_tx_queue_created_ptr = TX_NULL; \
|
||||
_tx_queue_created_count = TX_EMPTY
|
||||
_tx_queue_created_count = TX_EMPTY
|
||||
#else
|
||||
#define _tx_queue_initialize() \
|
||||
_tx_queue_created_ptr = TX_NULL; \
|
||||
_tx_queue_created_count = TX_EMPTY; \
|
||||
_tx_queue_performance_messages_sent_count = ((ULONG) 0); \
|
||||
_tx_queue_performance__messages_received_count = ((ULONG) 0); \
|
||||
_tx_queue_performance__messages_received_count = ((ULONG) 0); \
|
||||
_tx_queue_performance_empty_suspension_count = ((ULONG) 0); \
|
||||
_tx_queue_performance_full_suspension_count = ((ULONG) 0); \
|
||||
_tx_queue_performance_timeout_count = ((ULONG) 0)
|
||||
@@ -83,7 +85,7 @@ VOID _tx_queue_initialize(VOID);
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the message copy macro. Note that the source and destination
|
||||
/* Define the message copy macro. Note that the source and destination
|
||||
pointers must be modified since they are used subsequently. */
|
||||
|
||||
#ifndef TX_QUEUE_MESSAGE_COPY
|
||||
@@ -111,7 +113,7 @@ VOID _tx_queue_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_QUEUE_INIT
|
||||
#define QUEUE_DECLARE
|
||||
#define QUEUE_DECLARE
|
||||
#else
|
||||
#define QUEUE_DECLARE extern
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Semaphore */
|
||||
@@ -21,27 +21,29 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_semaphore.h PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_semaphore.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX semaphore management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* This file defines the ThreadX semaphore management component, */
|
||||
/* including all data types and external references. It is assumed */
|
||||
/* that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -54,15 +56,15 @@
|
||||
#define TX_SEMAPHORE_ID ((ULONG) 0x53454D41)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
/* Yes, in-line initialization is supported, remap the
|
||||
/* Yes, in-line initialization is supported, remap the
|
||||
semaphore initialization function. */
|
||||
#ifndef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
|
||||
#define _tx_semaphore_initialize() \
|
||||
_tx_semaphore_created_ptr = TX_NULL; \
|
||||
_tx_semaphore_created_count = TX_EMPTY
|
||||
_tx_semaphore_created_count = TX_EMPTY
|
||||
#else
|
||||
#define _tx_semaphore_initialize() \
|
||||
_tx_semaphore_created_ptr = TX_NULL; \
|
||||
@@ -74,7 +76,7 @@
|
||||
#endif
|
||||
#define TX_SEMAPHORE_INIT
|
||||
#else
|
||||
/* No in-line initialization is supported, use standard
|
||||
/* No in-line initialization is supported, use standard
|
||||
function call. */
|
||||
VOID _tx_semaphore_initialize(VOID);
|
||||
#endif
|
||||
@@ -92,7 +94,7 @@ VOID _tx_semaphore_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequen
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_SEMAPHORE_INIT
|
||||
#define SEMAPHORE_DECLARE
|
||||
#define SEMAPHORE_DECLARE
|
||||
#else
|
||||
#define SEMAPHORE_DECLARE extern
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Timer */
|
||||
@@ -21,24 +21,24 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_timer.h PORTABLE SMP */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_timer.h PORTABLE SMP */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX timer management component, including */
|
||||
/* */
|
||||
/* This file defines the ThreadX timer management component, including */
|
||||
/* data types and external references. It is assumed that tx_api.h */
|
||||
/* and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 William E. Lamie Initial Version 6.1 */
|
||||
@@ -73,14 +73,14 @@ VOID _tx_timer_thread_entry(ULONG timer_thread_input);
|
||||
#define TIMER_DECLARE extern
|
||||
|
||||
|
||||
/* Define the system clock value that is continually incremented by the
|
||||
/* Define the system clock value that is continually incremented by the
|
||||
periodic timer interrupt processing. */
|
||||
|
||||
TIMER_DECLARE volatile ULONG _tx_timer_system_clock;
|
||||
|
||||
|
||||
/* 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. */
|
||||
|
||||
TIMER_DECLARE ULONG _tx_timer_time_slice[TX_THREAD_SMP_MAX_CORES];
|
||||
@@ -116,7 +116,7 @@ TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_list_end;
|
||||
TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_current_ptr;
|
||||
|
||||
|
||||
/* Define the timer expiration flag. This is used to indicate that a timer
|
||||
/* Define the timer expiration flag. This is used to indicate that a timer
|
||||
has expired. */
|
||||
|
||||
TIMER_DECLARE UINT _tx_timer_expired;
|
||||
@@ -195,14 +195,16 @@ TIMER_DECLARE ULONG _tx_timer_performance_expiration_count;
|
||||
|
||||
|
||||
/* Define the total number of timer expiration adjustments. These are required
|
||||
if the expiration time is greater than the size of the timer list. In such
|
||||
cases, the timer is placed at the end of the list and then reactivated
|
||||
if the expiration time is greater than the size of the timer list. In such
|
||||
cases, the timer is placed at the end of the list and then reactivated
|
||||
as many times as necessary to finally achieve the resulting timeout. */
|
||||
|
||||
TIMER_DECLARE ULONG _tx_timer_performance__expiration_adjust_count;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Define default post timer delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
|
||||
|
||||
#ifndef TX_TIMER_DELETE_PORT_COMPLETION
|
||||
@@ -211,4 +213,3 @@ TIMER_DECLARE ULONG _tx_timer_performance__expiration_adjust_count;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,35 +12,37 @@
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Trace */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_trace.h PORTABLE SMP */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_trace.h PORTABLE SMP */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This file defines the ThreadX trace component, including constants */
|
||||
/* and structure definitions as well as external references. It is */
|
||||
/* */
|
||||
/* This file defines the ThreadX trace component, including constants */
|
||||
/* and structure definitions as well as external references. It is */
|
||||
/* assumed that tx_api.h and tx_port.h have already been included. */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -55,10 +57,10 @@
|
||||
macros to whitespace. */
|
||||
|
||||
#ifndef TX_ENABLE_EVENT_TRACE
|
||||
#define TX_TRACE_INITIALIZE
|
||||
#define TX_TRACE_OBJECT_REGISTER(t,p,n,a,b)
|
||||
#define TX_TRACE_OBJECT_UNREGISTER(o)
|
||||
#define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f)
|
||||
#define TX_TRACE_INITIALIZE
|
||||
#define TX_TRACE_OBJECT_REGISTER(t,p,n,a,b)
|
||||
#define TX_TRACE_OBJECT_UNREGISTER(o)
|
||||
#define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f)
|
||||
#else
|
||||
|
||||
/* Event tracing is enabled. */
|
||||
@@ -76,8 +78,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the default clock source for trace event entry time stamp. The following two item are port specific.
|
||||
For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
|
||||
/* Define the default clock source for trace event entry time stamp. The following two item are port specific.
|
||||
For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
|
||||
source constants would be:
|
||||
|
||||
#define TX_TRACE_TIME_SOURCE *((ULONG *) 0x0a800024)
|
||||
@@ -99,8 +101,8 @@
|
||||
|
||||
|
||||
/* ThreadX Trace Description. The ThreadX Trace feature is designed to capture
|
||||
events in real-time in a circular event buffer. This buffer may be analyzed by other
|
||||
tools. The high-level format of the Trace structure is:
|
||||
events in real-time in a circular event buffer. This buffer may be analyzed by other
|
||||
tools. The high-level format of the Trace structure is:
|
||||
|
||||
[Trace Control Header ]
|
||||
[Trace Object Registry - Entry 0 ]
|
||||
@@ -113,23 +115,23 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Trace Control Header. The Trace Control Header contains information that
|
||||
defines the format of the Trace Object Registry as well as the location and
|
||||
current entry of the Trace Buffer itself. The high-level format of the
|
||||
/* Trace Control Header. The Trace Control Header contains information that
|
||||
defines the format of the Trace Object Registry as well as the location and
|
||||
current entry of the Trace Buffer itself. The high-level format of the
|
||||
Trace Control Header is:
|
||||
|
||||
Entry Size Description
|
||||
|
||||
[Trace ID] 4 This 4-byte field contains the ThreadX Trace
|
||||
Identification. If the trace buffer is valid, the
|
||||
contents are 0x54585442 (TXTB). Since it is written as
|
||||
contents are 0x54585442 (TXTB). Since it is written as
|
||||
a 32-bit unsigned word, this value is also used to
|
||||
determine if the event trace information is in
|
||||
determine if the event trace information is in
|
||||
little or big endian format.
|
||||
[Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This
|
||||
[Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This
|
||||
enables use of 32, 24, 16, or event 8-bit timers.
|
||||
If the time source is 32-bits, the mask is
|
||||
0xFFFFFFFF. If the time source is 16-bits, the
|
||||
If the time source is 32-bits, the mask is
|
||||
0xFFFFFFFF. If the time source is 16-bits, the
|
||||
mask is 0x0000FFFF.
|
||||
[Trace Base Address] 4 The base address for all trace pointer. Subtracting
|
||||
the pointer and this address will yield the proper
|
||||
@@ -141,7 +143,7 @@
|
||||
[Trace Buffer Start Pointer] 4 Pointer to the start of the Trace Buffer Area
|
||||
[Trace Buffer End Pointer] 4 Pointer to the end of the Trace Buffer Area
|
||||
[Trace Buffer Current Pointer] 4 Pointer to the oldest entry in the Trace Buffer.
|
||||
This entry will be overwritten on the next event and
|
||||
This entry will be overwritten on the next event and
|
||||
incremented to the next event (wrapping to the top
|
||||
if the buffer end pointer is exceeded).
|
||||
[Reserved] 4 Reserved 4 bytes, should be 0xAAAAAAAA
|
||||
@@ -171,7 +173,7 @@ typedef struct TX_TRACE_HEADER_STRUCT
|
||||
} TX_TRACE_HEADER;
|
||||
|
||||
|
||||
/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to
|
||||
/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to
|
||||
the application's name for the object (defined during object creation in ThreadX). */
|
||||
|
||||
#ifndef TX_TRACE_OBJECT_REGISTRY_NAME
|
||||
@@ -179,31 +181,31 @@ typedef struct TX_TRACE_HEADER_STRUCT
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the object name types as well as the contents of any additional parameters that might be useful in
|
||||
/* Define the object name types as well as the contents of any additional parameters that might be useful in
|
||||
trace analysis. */
|
||||
|
||||
#define TX_TRACE_OBJECT_TYPE_NOT_VALID ((UCHAR) 0) /* Object is not valid */
|
||||
#define TX_TRACE_OBJECT_TYPE_NOT_VALID ((UCHAR) 0) /* Object is not valid */
|
||||
#define TX_TRACE_OBJECT_TYPE_THREAD ((UCHAR) 1) /* P1 = stack start address, P2 = stack size */
|
||||
#define TX_TRACE_OBJECT_TYPE_TIMER ((UCHAR) 2) /* P1 = initial ticks, P2 = reschedule ticks */
|
||||
#define TX_TRACE_OBJECT_TYPE_QUEUE ((UCHAR) 3) /* P1 = queue size, P2 = message size */
|
||||
#define TX_TRACE_OBJECT_TYPE_SEMAPHORE ((UCHAR) 4) /* P1 = initial instances */
|
||||
#define TX_TRACE_OBJECT_TYPE_MUTEX ((UCHAR) 5) /* P1 = priority inheritance flag */
|
||||
#define TX_TRACE_OBJECT_TYPE_EVENT_FLAGS ((UCHAR) 6) /* none */
|
||||
#define TX_TRACE_OBJECT_TYPE_BLOCK_POOL ((UCHAR) 7) /* P1 = total blocks, P2 = block size */
|
||||
#define TX_TRACE_OBJECT_TYPE_BYTE_POOL ((UCHAR) 8) /* P1 = total bytes */
|
||||
#define TX_TRACE_OBJECT_TYPE_TIMER ((UCHAR) 2) /* P1 = initial ticks, P2 = reschedule ticks */
|
||||
#define TX_TRACE_OBJECT_TYPE_QUEUE ((UCHAR) 3) /* P1 = queue size, P2 = message size */
|
||||
#define TX_TRACE_OBJECT_TYPE_SEMAPHORE ((UCHAR) 4) /* P1 = initial instances */
|
||||
#define TX_TRACE_OBJECT_TYPE_MUTEX ((UCHAR) 5) /* P1 = priority inheritance flag */
|
||||
#define TX_TRACE_OBJECT_TYPE_EVENT_FLAGS ((UCHAR) 6) /* none */
|
||||
#define TX_TRACE_OBJECT_TYPE_BLOCK_POOL ((UCHAR) 7) /* P1 = total blocks, P2 = block size */
|
||||
#define TX_TRACE_OBJECT_TYPE_BYTE_POOL ((UCHAR) 8) /* P1 = total bytes */
|
||||
|
||||
|
||||
typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
{
|
||||
|
||||
UCHAR tx_trace_object_entry_available; /* TX_TRUE -> available */
|
||||
UCHAR tx_trace_object_entry_type; /* Types defined above */
|
||||
UCHAR tx_trace_object_entry_reserved1; /* Should be zero - except for thread */
|
||||
UCHAR tx_trace_object_entry_reserved2; /* Should be zero - except for thread */
|
||||
UCHAR tx_trace_object_entry_type; /* Types defined above */
|
||||
UCHAR tx_trace_object_entry_reserved1; /* Should be zero - except for thread */
|
||||
UCHAR tx_trace_object_entry_reserved2; /* Should be zero - except for thread */
|
||||
ULONG tx_trace_object_entry_thread_pointer; /* ThreadX object pointer */
|
||||
ULONG tx_trace_object_entry_param_1; /* Parameter value defined */
|
||||
ULONG tx_trace_object_entry_param_2; /* according to type above */
|
||||
UCHAR tx_trace_object_entry_name[TX_TRACE_OBJECT_REGISTRY_NAME]; /* Object name */
|
||||
ULONG tx_trace_object_entry_param_1; /* Parameter value defined */
|
||||
ULONG tx_trace_object_entry_param_2; /* according to type above */
|
||||
UCHAR tx_trace_object_entry_name[TX_TRACE_OBJECT_REGISTRY_NAME]; /* Object name */
|
||||
} TX_TRACE_OBJECT_ENTRY;
|
||||
|
||||
|
||||
@@ -212,27 +214,27 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
|
||||
Entry Size Description
|
||||
|
||||
[Thread Pointer] 4 This 4-byte field contains the pointer to the
|
||||
ThreadX thread running that caused the event.
|
||||
[Thread Pointer] 4 This 4-byte field contains the pointer to the
|
||||
ThreadX thread running that caused the event.
|
||||
If this field is NULL, the entry hasn't been used
|
||||
yet. If this field is 0xFFFFFFFF, the event occurred
|
||||
from within an ISR. If this entry is 0xF0F0F0F0, the
|
||||
from within an ISR. If this entry is 0xF0F0F0F0, the
|
||||
event occurred during initialization.
|
||||
[Thread Priority or 4 This 4-byte field contains the current thread pointer for interrupt
|
||||
Current Thread events or the thread preemption-threshold/priority for thread events.
|
||||
Preemption-Threshold/
|
||||
Priority]
|
||||
[Event ID] 4 This 4-byte field contains the Event ID of the event. A value of
|
||||
[Event ID] 4 This 4-byte field contains the Event ID of the event. A value of
|
||||
0xFFFFFFFF indicates the event is invalid. All events are marked
|
||||
as invalid during initialization.
|
||||
[Time Stamp] 4 This 4-byte field contains the time stamp of the event.
|
||||
[Information Field 1] 4 This 4-byte field contains the first 4-bytes of information
|
||||
[Information Field 1] 4 This 4-byte field contains the first 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 2] 4 This 4-byte field contains the second 4-bytes of information
|
||||
[Information Field 2] 4 This 4-byte field contains the second 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 3] 4 This 4-byte field contains the third 4-bytes of information
|
||||
[Information Field 3] 4 This 4-byte field contains the third 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information
|
||||
[Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information
|
||||
specific to the event.
|
||||
*/
|
||||
|
||||
@@ -242,48 +244,48 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
/* Define ThreadX Trace Events, along with a brief description of the additional information fields,
|
||||
where I1 -> Information Field 1, I2 -> Information Field 2, etc. */
|
||||
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
FileX events: 200-299
|
||||
NetX events: 300-599
|
||||
USBX events: 600-999
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
on these constants in case the user event number assignment is changed in future releases. */
|
||||
|
||||
/* Define the basic ThreadX thread scheduling events first. */
|
||||
|
||||
#define TX_TRACE_THREAD_RESUME 1 /* I1 = thread ptr, I2 = previous_state, I3 = stack ptr, I4 = next thread */
|
||||
#define TX_TRACE_THREAD_SUSPEND 2 /* I1 = thread ptr, I2 = new_state, I3 = stack ptr I4 = next thread */
|
||||
#define TX_TRACE_ISR_ENTER 3 /* I1 = stack_ptr, I2 = ISR number, I3 = system state, I4 = preempt disable */
|
||||
#define TX_TRACE_ISR_EXIT 4 /* I1 = stack_ptr, I2 = ISR number, I3 = system state, I4 = preempt disable */
|
||||
#define TX_TRACE_TIME_SLICE 5 /* I1 = next thread ptr, I2 = system state, I3 = preempt disable, I4 = stack*/
|
||||
#define TX_TRACE_RUNNING 6 /* None */
|
||||
#define TX_TRACE_THREAD_RESUME 1 /* I1 = thread ptr, I2 = previous_state, I3 = stack ptr, I4 = next thread */
|
||||
#define TX_TRACE_THREAD_SUSPEND 2 /* I1 = thread ptr, I2 = new_state, I3 = stack ptr I4 = next thread */
|
||||
#define TX_TRACE_ISR_ENTER 3 /* I1 = stack_ptr, I2 = ISR number, I3 = system state, I4 = preempt disable */
|
||||
#define TX_TRACE_ISR_EXIT 4 /* I1 = stack_ptr, I2 = ISR number, I3 = system state, I4 = preempt disable */
|
||||
#define TX_TRACE_TIME_SLICE 5 /* I1 = next thread ptr, I2 = system state, I3 = preempt disable, I4 = stack*/
|
||||
#define TX_TRACE_RUNNING 6 /* None */
|
||||
|
||||
|
||||
/* Define the rest of the ThreadX system events. */
|
||||
|
||||
#define TX_TRACE_BLOCK_ALLOCATE 10 /* I1 = pool ptr, I2 = memory ptr, I3 = wait option, I4 = remaining blocks */
|
||||
#define TX_TRACE_BLOCK_POOL_CREATE 11 /* I1 = pool ptr, I2 = pool_start, I3 = total blocks, I4 = block size */
|
||||
#define TX_TRACE_BLOCK_POOL_DELETE 12 /* I1 = pool ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_BLOCK_ALLOCATE 10 /* I1 = pool ptr, I2 = memory ptr, I3 = wait option, I4 = remaining blocks */
|
||||
#define TX_TRACE_BLOCK_POOL_CREATE 11 /* I1 = pool ptr, I2 = pool_start, I3 = total blocks, I4 = block size */
|
||||
#define TX_TRACE_BLOCK_POOL_DELETE 12 /* I1 = pool ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_BLOCK_POOL_INFO_GET 13 /* I1 = pool ptr */
|
||||
#define TX_TRACE_BLOCK_POOL_PERFORMANCE_INFO_GET 14 /* I1 = pool ptr */
|
||||
#define TX_TRACE_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET 15 /* None */
|
||||
#define TX_TRACE_BLOCK_POOL_PERFORMANCE_INFO_GET 14 /* I1 = pool ptr */
|
||||
#define TX_TRACE_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET 15 /* None */
|
||||
#define TX_TRACE_BLOCK_POOL_PRIORITIZE 16 /* I1 = pool ptr, I2 = suspended count, I3 = stack ptr */
|
||||
#define TX_TRACE_BLOCK_RELEASE 17 /* I1 = pool ptr, I2 = memory ptr, I3 = suspended, I4 = stack ptr */
|
||||
#define TX_TRACE_BYTE_ALLOCATE 20 /* I1 = pool ptr, I2 = memory ptr, I3 = size requested, I4 = wait option */
|
||||
#define TX_TRACE_BYTE_POOL_CREATE 21 /* I1 = pool ptr, I2 = start ptr, I3 = pool size, I4 = stack ptr */
|
||||
#define TX_TRACE_BYTE_POOL_DELETE 22 /* I1 = pool ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_BLOCK_RELEASE 17 /* I1 = pool ptr, I2 = memory ptr, I3 = suspended, I4 = stack ptr */
|
||||
#define TX_TRACE_BYTE_ALLOCATE 20 /* I1 = pool ptr, I2 = memory ptr, I3 = size requested, I4 = wait option */
|
||||
#define TX_TRACE_BYTE_POOL_CREATE 21 /* I1 = pool ptr, I2 = start ptr, I3 = pool size, I4 = stack ptr */
|
||||
#define TX_TRACE_BYTE_POOL_DELETE 22 /* I1 = pool ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_BYTE_POOL_INFO_GET 23 /* I1 = pool ptr */
|
||||
#define TX_TRACE_BYTE_POOL_PERFORMANCE_INFO_GET 24 /* I1 = pool ptr */
|
||||
#define TX_TRACE_BYTE_POOL__PERFORMANCE_SYSTEM_INFO_GET 25 /* None */
|
||||
#define TX_TRACE_BYTE_POOL_PRIORITIZE 26 /* I1 = pool ptr, I2 = suspended count, I3 = stack ptr */
|
||||
#define TX_TRACE_BYTE_RELEASE 27 /* I1 = pool ptr, I2 = memory ptr, I3 = suspended, I4 = available bytes */
|
||||
#define TX_TRACE_EVENT_FLAGS_CREATE 30 /* I1 = group ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS_DELETE 31 /* I1 = group ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS_GET 32 /* I1 = group ptr, I2 = requested flags, I3 = current flags, I4 = get option*/
|
||||
#define TX_TRACE_BYTE_RELEASE 27 /* I1 = pool ptr, I2 = memory ptr, I3 = suspended, I4 = available bytes */
|
||||
#define TX_TRACE_EVENT_FLAGS_CREATE 30 /* I1 = group ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS_DELETE 31 /* I1 = group ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS_GET 32 /* I1 = group ptr, I2 = requested flags, I3 = current flags, I4 = get option*/
|
||||
#define TX_TRACE_EVENT_FLAGS_INFO_GET 33 /* I1 = group ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS_PERFORMANCE_INFO_GET 34 /* I1 = group ptr */
|
||||
#define TX_TRACE_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET 35 /* None */
|
||||
@@ -340,7 +342,7 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
#define TX_TRACE_TIME_GET 120 /* I1 = current time, I2 = stack ptr */
|
||||
#define TX_TRACE_TIME_SET 121 /* I1 = new time */
|
||||
#define TX_TRACE_TIMER_ACTIVATE 122 /* I1 = timer ptr */
|
||||
#define TX_TRACE_TIMER_CHANGE 123 /* I1 = timer ptr, I2 = initial ticks, I3= reschedule ticks */
|
||||
#define TX_TRACE_TIMER_CHANGE 123 /* I1 = timer ptr, I2 = initial ticks, I3= reschedule ticks */
|
||||
#define TX_TRACE_TIMER_CREATE 124 /* I1 = timer ptr, I2 = initial ticks, I3= reschedule ticks, I4 = enable */
|
||||
#define TX_TRACE_TIMER_DEACTIVATE 125 /* I1 = timer ptr, I2 = stack ptr */
|
||||
#define TX_TRACE_TIMER_DELETE 126 /* I1 = timer ptr */
|
||||
@@ -379,7 +381,7 @@ typedef struct TX_TRACE_BUFFER_ENTRY_STRUCT
|
||||
make them extern so other functions in the component can access them. */
|
||||
|
||||
#ifdef TX_TRACE_INIT
|
||||
#define TRACE_DECLARE
|
||||
#define TRACE_DECLARE
|
||||
#else
|
||||
#define TRACE_DECLARE extern
|
||||
#endif
|
||||
@@ -387,7 +389,7 @@ typedef struct TX_TRACE_BUFFER_ENTRY_STRUCT
|
||||
|
||||
/* Define the pointer to the start of the trace buffer control structure. */
|
||||
|
||||
TRACE_DECLARE TX_TRACE_HEADER *_tx_trace_header_ptr;
|
||||
TRACE_DECLARE TX_TRACE_HEADER *_tx_trace_header_ptr;
|
||||
|
||||
|
||||
/* Define the pointer to the start of the trace object registry area in the trace buffer. */
|
||||
@@ -415,8 +417,8 @@ TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_end_ptr;
|
||||
TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_current_ptr;
|
||||
|
||||
|
||||
/* Define the trace event enable bits, where each bit represents a type of event that can be enabled
|
||||
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. */
|
||||
|
||||
TRACE_DECLARE ULONG _tx_trace_event_enable_bits;
|
||||
|
||||
@@ -427,9 +429,9 @@ TRACE_DECLARE ULONG _tx_trace_event_enable_bits;
|
||||
TRACE_DECLARE ULONG _tx_trace_simulated_time;
|
||||
|
||||
|
||||
/* Define the function pointer used to call the application when the trace buffer wraps. If NULL,
|
||||
/* Define the function pointer used to call the application when the trace buffer wraps. If NULL,
|
||||
the application has not registered a callback function. */
|
||||
|
||||
|
||||
TRACE_DECLARE VOID (*_tx_trace_full_notify_function)(VOID *buffer);
|
||||
|
||||
|
||||
@@ -451,9 +453,9 @@ TRACE_DECLARE ULONG _tx_trace_registry_search_start
|
||||
/* Define the event trace macros that are expanded in-line when event tracing is enabled. */
|
||||
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
#define TX_TRACE_INFO_FIELD_ASSIGNMENT(a,b,c,d) trace_event_ptr -> tx_trace_buffer_entry_info_1 = (ULONG) (a); trace_event_ptr -> tx_trace_buffer_entry_info_2 = (ULONG) (b); trace_event_ptr -> tx_trace_buffer_entry_info_3 = (ULONG) (c); trace_event_ptr -> tx_trace_buffer_entry_info_4 = (ULONG) (d);
|
||||
#define TX_TRACE_INFO_FIELD_ASSIGNMENT(a,b,c,d) trace_event_ptr -> tx_trace_buffer_entry_info_1 = (ULONG) (a); trace_event_ptr -> tx_trace_buffer_entry_info_2 = (ULONG) (b); trace_event_ptr -> tx_trace_buffer_entry_info_3 = (ULONG) (c); trace_event_ptr -> tx_trace_buffer_entry_info_4 = (ULONG) (d);
|
||||
#else
|
||||
#define TX_TRACE_INFO_FIELD_ASSIGNMENT(a,b,c,d) trace_event_ptr -> tx_trace_buffer_entry_information_field_1 = (ULONG) (a); trace_event_ptr -> tx_trace_buffer_entry_information_field_2 = (ULONG) (b); trace_event_ptr -> tx_trace_buffer_entry_information_field_3 = (ULONG) (c); trace_event_ptr -> tx_trace_buffer_entry_information_field_4 = (ULONG) (d);
|
||||
#define TX_TRACE_INFO_FIELD_ASSIGNMENT(a,b,c,d) trace_event_ptr -> tx_trace_buffer_entry_information_field_1 = (ULONG) (a); trace_event_ptr -> tx_trace_buffer_entry_information_field_2 = (ULONG) (b); trace_event_ptr -> tx_trace_buffer_entry_information_field_3 = (ULONG) (c); trace_event_ptr -> tx_trace_buffer_entry_information_field_4 = (ULONG) (d);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -524,6 +526,7 @@ VOID _tx_trace_initialize(VOID);
|
||||
VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
|
||||
VOID _tx_trace_object_unregister(VOID *object_ptr);
|
||||
|
||||
|
||||
#ifdef TX_ENABLE_EVENT_TRACE
|
||||
|
||||
/* Check for MISRA compliance requirements. */
|
||||
@@ -535,7 +538,7 @@ VOID _tx_trace_object_unregister(VOID *object_ptr);
|
||||
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_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);
|
||||
UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer);
|
||||
|
||||
|
||||
@@ -556,6 +559,5 @@ UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* PORT SPECIFIC C INFORMATION RELEASE */
|
||||
/* */
|
||||
/* tx_user.h PORTABLE C */
|
||||
/* 6.1.5 */
|
||||
/* 6.1.9 */
|
||||
/* */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
@@ -44,7 +44,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 */
|
||||
/* 03-02-2021 Scott Larson Modified comment(s), */
|
||||
/* added option to remove */
|
||||
/* FileX pointer, */
|
||||
@@ -52,6 +54,10 @@
|
||||
/* 06-02-2021 Scott Larson Added options for multiple */
|
||||
/* block pool search & delay, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 10-15-2021 Yuxin Zhou Modified comment(s), added */
|
||||
/* user-configurable symbol */
|
||||
/* TX_TIMER_TICKS_PER_SECOND */
|
||||
/* resulting in version 6.1.9 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -60,9 +66,9 @@
|
||||
|
||||
|
||||
/* Define various build options for the ThreadX port. The application should either make changes
|
||||
here by commenting or un-commenting the conditional compilation defined OR supply the defines
|
||||
though the compiler's equivalent of the -D option.
|
||||
|
||||
here by commenting or un-commenting the conditional compilation defined OR supply the defines
|
||||
though the compiler's equivalent of the -D option.
|
||||
|
||||
For maximum speed, the following should be defined:
|
||||
|
||||
TX_MAX_PRIORITIES 32
|
||||
@@ -74,9 +80,9 @@
|
||||
TX_REACTIVATE_INLINE
|
||||
TX_DISABLE_STACK_FILLING
|
||||
TX_INLINE_THREAD_RESUME_SUSPEND
|
||||
|
||||
|
||||
For minimum size, the following should be defined:
|
||||
|
||||
|
||||
TX_MAX_PRIORITIES 32
|
||||
TX_DISABLE_PREEMPTION_THRESHOLD
|
||||
TX_DISABLE_REDUNDANT_CLEARING
|
||||
@@ -84,12 +90,12 @@
|
||||
TX_NO_FILEX_POINTER
|
||||
TX_NOT_INTERRUPTABLE
|
||||
TX_TIMER_PROCESS_IN_ISR
|
||||
|
||||
|
||||
Of course, many of these defines reduce functionality and/or change the behavior of the
|
||||
system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR
|
||||
results in faster and smaller code, however, it increases the amount of processing in the ISR.
|
||||
In addition, some services that are available in timers are not available from ISRs and will
|
||||
therefore return an error if this option is used. This may or may not be desirable for a
|
||||
therefore return an error if this option is used. This may or may not be desirable for a
|
||||
given application. */
|
||||
|
||||
|
||||
@@ -104,19 +110,28 @@
|
||||
#define TX_TIMER_THREAD_PRIORITY ????
|
||||
*/
|
||||
|
||||
/* Define the common timer tick reference for use by other middleware components. The default
|
||||
value is 10ms (i.e. 100 ticks, defined in tx_api.h), but may be replaced by a port-specific
|
||||
version in tx_port.h or here.
|
||||
Note: the actual hardware timer value may need to be changed (usually in tx_initialize_low_level). */
|
||||
|
||||
/*
|
||||
#define TX_TIMER_TICKS_PER_SECOND ((ULONG) 100)
|
||||
*/
|
||||
|
||||
/* Determine if there is a FileX pointer in the thread control block.
|
||||
By default, the pointer is there for legacy/backwards compatibility.
|
||||
By default, the pointer is there for legacy/backwards compatibility.
|
||||
The pointer must also be there for applications using FileX.
|
||||
Define this to save space in the thread control block.
|
||||
Define this to save space in the thread control block.
|
||||
*/
|
||||
|
||||
/*
|
||||
#define TX_NO_FILEX_POINTER
|
||||
*/
|
||||
|
||||
/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
|
||||
should be processed within the a system timer thread or directly in the timer ISR.
|
||||
By default, the timer thread is used. When the following is defined, the timer expiration
|
||||
/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
|
||||
should be processed within the a system timer thread or directly in the timer ISR.
|
||||
By default, the timer thread is used. When the following is defined, the timer expiration
|
||||
processing is done directly from the timer ISR, thereby eliminating the timer thread control
|
||||
block, stack, and context switching to activate it. */
|
||||
|
||||
@@ -141,7 +156,7 @@
|
||||
#define TX_DISABLE_STACK_FILLING
|
||||
*/
|
||||
|
||||
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
||||
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
||||
disabled. When the following is defined, ThreadX thread stack checking is enabled. If stack
|
||||
checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
|
||||
define is negated, thereby forcing the stack fill which is necessary for the stack checking
|
||||
@@ -151,7 +166,7 @@
|
||||
#define TX_ENABLE_STACK_CHECKING
|
||||
*/
|
||||
|
||||
/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
|
||||
/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
|
||||
enabled. If the application does not use preemption-threshold, it may be disabled to reduce
|
||||
code size and improve performance. */
|
||||
|
||||
@@ -159,7 +174,7 @@
|
||||
#define TX_DISABLE_PREEMPTION_THRESHOLD
|
||||
*/
|
||||
|
||||
/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
|
||||
/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
|
||||
the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary
|
||||
clearing of ThreadX global variables. */
|
||||
|
||||
@@ -167,9 +182,9 @@
|
||||
#define TX_DISABLE_REDUNDANT_CLEARING
|
||||
*/
|
||||
|
||||
/* Determine if no timer processing is required. This option will help eliminate the timer
|
||||
processing when not needed. The user will also have to comment out the call to
|
||||
tx_timer_interrupt, which is typically made from assembly language in
|
||||
/* Determine if no timer processing is required. This option will help eliminate the timer
|
||||
processing when not needed. The user will also have to comment out the call to
|
||||
tx_timer_interrupt, which is typically made from assembly language in
|
||||
tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR
|
||||
must also be used and tx_timer_initialize must be removed from ThreadX library. */
|
||||
|
||||
@@ -189,8 +204,8 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
|
||||
code in-line. This results in a larger image, but improves the performance of the thread
|
||||
/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
|
||||
code in-line. This results in a larger image, but improves the performance of the thread
|
||||
resume and suspend services. */
|
||||
|
||||
/*
|
||||
@@ -198,7 +213,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
|
||||
/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
|
||||
size and less processing overhead, but increases the interrupt lockout time. */
|
||||
|
||||
/*
|
||||
@@ -206,8 +221,8 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the trace event logging code should be enabled. This causes slight increases in
|
||||
code size and overhead, but provides the ability to generate system trace information which
|
||||
/* Determine if the trace event logging code should be enabled. This causes slight increases in
|
||||
code size and overhead, but provides the ability to generate system trace information which
|
||||
is available for viewing in TraceX. */
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user