Initial commit

This commit is contained in:
PProvost
2020-05-11 08:55:07 -06:00
commit 852421fda0
264 changed files with 54459 additions and 0 deletions
Executable
+40
View File
@@ -0,0 +1,40 @@
.git* export-ignore
.hooks* export-ignore
# Custom attribute to mark sources as using our C code style.
[attr]our-c-style whitespace=tab-in-indent eol=lf format.clang-format-6.0
# Custom attribute to mark sources as generated.
# Do not perform whitespace checks. Do not format.
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format-6.0
bootstrap eol=lf
configure eol=lf
*.[1-9] eol=lf
*.bash eol=lf
*.sh eol=lf
*.sh.in eol=lf
*.bat eol=crlf
*.bat.in eol=crlf
*.sln eol=crlf
*.vcproj eol=crlf
*.pfx -text
*.png -text
*.png.in -text
*.c our-c-style
*.cc our-c-style
*.cpp our-c-style
*.cu our-c-style
*.cxx our-c-style
*.h our-c-style
*.hh our-c-style
*.hpp our-c-style
*.hxx our-c-style
*.notcu our-c-style
*.cmake whitespace=tab-in-indent
*.rst whitespace=tab-in-indent conflict-marker-size=79
*.txt whitespace=tab-in-indent
+14
View File
@@ -0,0 +1,14 @@
.vscode/
_deps/
build/
CMakeFiles/
CMakeScripts/
CMakeLists.txt.user
CMakeCache.txt
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
+44
View File
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
# Set up the project
project(threadx
VERSION 6.0.0
LANGUAGES C ASM
)
if(NOT DEFINED THREADX_ARCH)
message(FATAL_ERROR "Error: THREADX_ARCH not defined")
endif()
if(NOT DEFINED THREADX_TOOLCHAIN)
message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
endif()
# Define our target library and an alias for consumers
add_library(${PROJECT_NAME})
add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
# A place for generated/copied include files (no need to change)
set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
# Pick up the port specific variables and apply them
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
# Pick up the common stuff
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
# If the user provided an override, copy it to the custom directory
if (NOT TX_USER_FILE)
message(STATUS "Using default tx_user.h file")
set(TX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/tx_user_sample.h)
else()
message(STATUS "Using custom tx_user.h file from ${UX_USER_FILE}")
endif()
configure_file(${TX_USER_FILE} ${CUSTOM_INC_DIR}/tx_user.h COPYONLY)
target_include_directories(${PROJECT_NAME}
PUBLIC
${CUSTOM_INC_DIR}
)
target_compile_definitions(${PROJECT_NAME} PUBLIC "TX_INCLUDE_USER_DEFINE_FILE" )
+246
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
LICENSED HARDWARE LIST
Last Updated: 2020-05-08
Microsoft has entered into OEM Agreements with manufacturers of the following
microprocessors and microcontrollers (the “hardware”) to enable those
manufacturers to include and distribute Azure RTOS in certain hardware. If you
have obtained and/or are developing on microprocessor(s) and/or
microcontroller(s) (“hardware”) listed below you inherit the “Distribution and
Production Use” rights in Section 2 of the Microsoft Software License Terms for
Microsoft Azure RTOS. If hardware is not listed below, you do not have those
rights.
--------------------------------------------------------------------------------
More coming soon. Please check back frequently for updates.
+1
View File
@@ -0,0 +1 @@
# ThreadX
+2
View File
@@ -0,0 +1,2 @@
TODO:
File diff suppressed because it is too large Load Diff
+2208
View File
File diff suppressed because it is too large Load Diff
+146
View File
@@ -0,0 +1,146 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Block Memory */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_block_pool.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_BLOCK_POOL_H
#define TX_BLOCK_POOL_H
/* Define block memory control specific data definitions. */
#define TX_BLOCK_POOL_ID ((ULONG) 0x424C4F43)
/* 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
initialization function. */
#ifndef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
#define _tx_block_pool_initialize() \
_tx_block_pool_created_ptr = TX_NULL; \
_tx_block_pool_created_count = TX_EMPTY
#else
#define _tx_block_pool_initialize() \
_tx_block_pool_created_ptr = TX_NULL; \
_tx_block_pool_created_count = TX_EMPTY; \
_tx_block_pool_performance_allocate_count = ((ULONG) 0); \
_tx_block_pool_performance_release_count = ((ULONG) 0); \
_tx_block_pool_performance_suspension_count = ((ULONG) 0); \
_tx_block_pool_performance_timeout_count = ((ULONG) 0)
#endif
#define TX_BLOCK_POOL_INIT
#else
/* No in-line initialization is supported, use standard function call. */
VOID _tx_block_pool_initialize(VOID);
#endif
/* Define internal block memory pool management function prototypes. */
VOID _tx_block_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
/* Block pool management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_BLOCK_POOL_INIT
#define BLOCK_POOL_DECLARE
#else
#define BLOCK_POOL_DECLARE extern
#endif
/* Define the head pointer of the created block pool list. */
BLOCK_POOL_DECLARE TX_BLOCK_POOL * _tx_block_pool_created_ptr;
/* Define the variable that holds the number of created block pools. */
BLOCK_POOL_DECLARE ULONG _tx_block_pool_created_count;
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
/* Define the total number of block allocates. */
BLOCK_POOL_DECLARE ULONG _tx_block_pool_performance_allocate_count;
/* Define the total number of block releases. */
BLOCK_POOL_DECLARE ULONG _tx_block_pool_performance_release_count;
/* Define the total number of block pool suspensions. */
BLOCK_POOL_DECLARE ULONG _tx_block_pool_performance_suspension_count;
/* Define the total number of block pool timeouts. */
BLOCK_POOL_DECLARE ULONG _tx_block_pool_performance_timeout_count;
#endif
/* Define default post block pool delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_BLOCK_POOL_DELETE_PORT_COMPLETION
#define TX_BLOCK_POOL_DELETE_PORT_COMPLETION(p)
#endif
#endif
+177
View File
@@ -0,0 +1,177 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Byte Memory */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_byte_pool.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_BYTE_POOL_H
#define TX_BYTE_POOL_H
/* Define byte memory control specific data definitions. */
#define TX_BYTE_POOL_ID ((ULONG) 0x42595445)
#ifndef TX_BYTE_BLOCK_FREE
#define TX_BYTE_BLOCK_FREE ((ULONG) 0xFFFFEEEEUL)
#endif
#ifndef TX_BYTE_BLOCK_MIN
#define TX_BYTE_BLOCK_MIN ((ULONG) 20)
#endif
#ifndef TX_BYTE_POOL_MIN
#define TX_BYTE_POOL_MIN ((ULONG) 100)
#endif
/* 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
initialization function. */
#ifndef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
#define _tx_byte_pool_initialize() \
_tx_byte_pool_created_ptr = TX_NULL; \
_tx_byte_pool_created_count = TX_EMPTY
#else
#define _tx_byte_pool_initialize() \
_tx_byte_pool_created_ptr = TX_NULL; \
_tx_byte_pool_created_count = TX_EMPTY; \
_tx_byte_pool_performance_allocate_count = ((ULONG) 0); \
_tx_byte_pool_performance_release_count = ((ULONG) 0); \
_tx_byte_pool_performance_merge_count = ((ULONG) 0); \
_tx_byte_pool_performance_split_count = ((ULONG) 0); \
_tx_byte_pool_performance_search_count = ((ULONG) 0); \
_tx_byte_pool_performance_suspension_count = ((ULONG) 0); \
_tx_byte_pool_performance_timeout_count = ((ULONG) 0)
#endif
#define TX_BYTE_POOL_INIT
#else
/* No in-line initialization is supported, use standard function call. */
VOID _tx_byte_pool_initialize(VOID);
#endif
/* Define internal byte memory pool management function prototypes. */
UCHAR *_tx_byte_pool_search(TX_BYTE_POOL *pool_ptr, ULONG memory_size);
VOID _tx_byte_pool_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
/* Byte pool management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_BYTE_POOL_INIT
#define BYTE_POOL_DECLARE
#else
#define BYTE_POOL_DECLARE extern
#endif
/* Define the head pointer of the created byte pool list. */
BYTE_POOL_DECLARE TX_BYTE_POOL * _tx_byte_pool_created_ptr;
/* Define the variable that holds the number of created byte pools. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_created_count;
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
/* Define the total number of allocates. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_allocate_count;
/* Define the total number of releases. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_release_count;
/* Define the total number of adjacent memory fragment merges. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_merge_count;
/* Define the total number of memory fragment splits. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_split_count;
/* Define the total number of memory fragments searched during allocation. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_search_count;
/* Define the total number of byte pool suspensions. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_suspension_count;
/* Define the total number of byte pool timeouts. */
BYTE_POOL_DECLARE ULONG _tx_byte_pool_performance_timeout_count;
#endif
/* Define default post byte pool delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_BYTE_POOL_DELETE_PORT_COMPLETION
#define TX_BYTE_POOL_DELETE_PORT_COMPLETION(p)
#endif
#endif
+147
View File
@@ -0,0 +1,147 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_event_flags.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_EVENT_FLAGS_H
#define TX_EVENT_FLAGS_H
/* Define event flags control specific data definitions. */
#define TX_EVENT_FLAGS_ID ((ULONG) 0x4456444E)
#define TX_EVENT_FLAGS_AND_MASK ((UINT) 0x2)
#define TX_EVENT_FLAGS_CLEAR_MASK ((UINT) 0x1)
/* 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
function. */
#ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
#define _tx_event_flags_initialize() \
_tx_event_flags_created_ptr = TX_NULL; \
_tx_event_flags_created_count = TX_EMPTY
#else
#define _tx_event_flags_initialize() \
_tx_event_flags_created_ptr = TX_NULL; \
_tx_event_flags_created_count = TX_EMPTY; \
_tx_event_flags_performance_set_count = ((ULONG) 0); \
_tx_event_flags_performance_get_count = ((ULONG) 0); \
_tx_event_flags_performance_suspension_count = ((ULONG) 0); \
_tx_event_flags_performance_timeout_count = ((ULONG) 0)
#endif
#define TX_EVENT_FLAGS_INIT
#else
/* No in-line initialization is supported, use standard function call. */
VOID _tx_event_flags_initialize(VOID);
#endif
/* Define internal event flags management function prototypes. */
VOID _tx_event_flags_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
/* Event flags management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_EVENT_FLAGS_INIT
#define EVENT_FLAGS_DECLARE
#else
#define EVENT_FLAGS_DECLARE extern
#endif
/* Define the head pointer of the created event flags list. */
EVENT_FLAGS_DECLARE TX_EVENT_FLAGS_GROUP * _tx_event_flags_created_ptr;
/* Define the variable that holds the number of created event flag groups. */
EVENT_FLAGS_DECLARE ULONG _tx_event_flags_created_count;
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
/* Define the total number of event flag sets. */
EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_set_count;
/* Define the total number of event flag gets. */
EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_get_count;
/* Define the total number of event flag suspensions. */
EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_suspension_count;
/* Define the total number of event flag timeouts. */
EVENT_FLAGS_DECLARE ULONG _tx_event_flags_performance_timeout_count;
#endif
/* Define default post event flag group delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_EVENT_FLAGS_GROUP_DELETE_PORT_COMPLETION
#define TX_EVENT_FLAGS_GROUP_DELETE_PORT_COMPLETION(g)
#endif
#endif
+111
View File
@@ -0,0 +1,111 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Initialize */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_initialize.h PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_INITIALIZE_H
#define TX_INITIALIZE_H
/* Define constants that indicate initialization is in progress. */
#define TX_INITIALIZE_IN_PROGRESS ((ULONG) 0xF0F0F0F0UL)
#define TX_INITIALIZE_ALMOST_DONE ((ULONG) 0xF0F0F0F1UL)
#define TX_INITIALIZE_IS_FINISHED ((ULONG) 0x00000000UL)
/* Define internal initialization function prototypes. */
VOID _tx_initialize_high_level(VOID);
VOID _tx_initialize_kernel_setup(VOID);
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.
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
#ifndef TX_PORT_SPECIFIC_POST_INITIALIZATION
#define TX_PORT_SPECIFIC_POST_INITIALIZATION
#endif
#ifndef TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION
#define TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION
#endif
/* Initialization component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_INITIALIZE_INIT
#define INITIALIZE_DECLARE
#else
#define INITIALIZE_DECLARE extern
#endif
/* 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
to the application's system definition function. */
INITIALIZE_DECLARE VOID *_tx_initialize_unused_memory;
#endif
+160
View File
@@ -0,0 +1,160 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Mutex */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_mutex.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_MUTEX_H
#define TX_MUTEX_H
/* Define mutex control specific data definitions. */
#define TX_MUTEX_ID ((ULONG) 0x4D555445)
/* 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
function. */
#ifndef TX_MUTEX_ENABLE_PERFORMANCE_INFO
#define _tx_mutex_initialize() \
_tx_mutex_created_ptr = TX_NULL; \
_tx_mutex_created_count = TX_EMPTY
#else
#define _tx_mutex_initialize() \
_tx_mutex_created_ptr = TX_NULL; \
_tx_mutex_created_count = TX_EMPTY; \
_tx_mutex_performance_put_count = ((ULONG) 0); \
_tx_mutex_performance_get_count = ((ULONG) 0); \
_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)
#endif
#define TX_MUTEX_INIT
#else
/* No in-line initialization is supported, use standard function call. */
VOID _tx_mutex_initialize(VOID);
#endif
/* Define internal mutex management function prototypes. */
VOID _tx_mutex_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
VOID _tx_mutex_thread_release(TX_THREAD *thread_ptr);
VOID _tx_mutex_priority_change(TX_THREAD *thread_ptr, UINT new_priority);
/* Mutex management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_MUTEX_INIT
#define MUTEX_DECLARE
#else
#define MUTEX_DECLARE extern
#endif
/* Define the head pointer of the created mutex list. */
MUTEX_DECLARE TX_MUTEX * _tx_mutex_created_ptr;
/* Define the variable that holds the number of created mutexes. */
MUTEX_DECLARE ULONG _tx_mutex_created_count;
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
/* Define the total number of mutex puts. */
MUTEX_DECLARE ULONG _tx_mutex_performance_put_count;
/* Define the total number of mutex gets. */
MUTEX_DECLARE ULONG _tx_mutex_performance_get_count;
/* Define the total number of mutex suspensions. */
MUTEX_DECLARE ULONG _tx_mutex_performance_suspension_count;
/* Define the total number of mutex timeouts. */
MUTEX_DECLARE ULONG _tx_mutex_performance_timeout_count;
/* Define the total number of priority inversions. */
MUTEX_DECLARE ULONG _tx_mutex_performance_priority_inversion_count;
/* Define the total number of priority inheritance conditions. */
MUTEX_DECLARE ULONG _tx_mutex_performance__priority_inheritance_count;
#endif
/* Define default post mutex delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_MUTEX_DELETE_PORT_COMPLETION
#define TX_MUTEX_DELETE_PORT_COMPLETION(m)
#endif
#endif
+173
View File
@@ -0,0 +1,173 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Queue */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_queue.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_QUEUE_H
#define TX_QUEUE_H
/* Define queue control specific data definitions. */
#define TX_QUEUE_ID ((ULONG) 0x51554555)
/* 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
function. */
#ifndef TX_QUEUE_ENABLE_PERFORMANCE_INFO
#define _tx_queue_initialize() \
_tx_queue_created_ptr = TX_NULL; \
_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_empty_suspension_count = ((ULONG) 0); \
_tx_queue_performance_full_suspension_count = ((ULONG) 0); \
_tx_queue_performance_timeout_count = ((ULONG) 0)
#endif
#define TX_QUEUE_INIT
#else
/* No in-line initialization is supported, use standard function call. */
VOID _tx_queue_initialize(VOID);
#endif
/* 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
#define TX_QUEUE_MESSAGE_COPY(s, d, z) \
*(d)++ = *(s)++; \
if ((z) > ((UINT) 1)) \
{ \
while (--(z)) \
{ \
*(d)++ = *(s)++; \
} \
}
#endif
/* Define internal queue management function prototypes. */
VOID _tx_queue_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
/* Queue management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_QUEUE_INIT
#define QUEUE_DECLARE
#else
#define QUEUE_DECLARE extern
#endif
/* Define the head pointer of the created queue list. */
QUEUE_DECLARE TX_QUEUE * _tx_queue_created_ptr;
/* Define the variable that holds the number of created queues. */
QUEUE_DECLARE ULONG _tx_queue_created_count;
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
/* Define the total number of messages sent. */
QUEUE_DECLARE ULONG _tx_queue_performance_messages_sent_count;
/* Define the total number of messages received. */
QUEUE_DECLARE ULONG _tx_queue_performance__messages_received_count;
/* Define the total number of queue empty suspensions. */
QUEUE_DECLARE ULONG _tx_queue_performance_empty_suspension_count;
/* Define the total number of queue full suspensions. */
QUEUE_DECLARE ULONG _tx_queue_performance_full_suspension_count;
/* Define the total number of queue full errors. */
QUEUE_DECLARE ULONG _tx_queue_performance_full_error_count;
/* Define the total number of queue timeouts. */
QUEUE_DECLARE ULONG _tx_queue_performance_timeout_count;
#endif
/* Define default post queue delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_QUEUE_DELETE_PORT_COMPLETION
#define TX_QUEUE_DELETE_PORT_COMPLETION(q)
#endif
#endif
+144
View File
@@ -0,0 +1,144 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_semaphore.h PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
#ifndef TX_SEMAPHORE_H
#define TX_SEMAPHORE_H
/* Define semaphore control specific data definitions. */
#define TX_SEMAPHORE_ID ((ULONG) 0x53454D41)
/* Determine if in-line component initialization is supported by the
caller. */
#ifdef TX_INVOKE_INLINE_INITIALIZATION
/* 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
#else
#define _tx_semaphore_initialize() \
_tx_semaphore_created_ptr = TX_NULL; \
_tx_semaphore_created_count = TX_EMPTY; \
_tx_semaphore_performance_put_count = ((ULONG) 0); \
_tx_semaphore_performance_get_count = ((ULONG) 0); \
_tx_semaphore_performance_suspension_count = ((ULONG) 0); \
_tx_semaphore_performance_timeout_count = ((ULONG) 0)
#endif
#define TX_SEMAPHORE_INIT
#else
/* No in-line initialization is supported, use standard
function call. */
VOID _tx_semaphore_initialize(VOID);
#endif
/* Define internal semaphore management function prototypes. */
VOID _tx_semaphore_cleanup(TX_THREAD *thread_ptr, ULONG suspension_sequence);
/* Semaphore management component data declarations follow. */
/* Determine if the initialization function of this component is including
this file. If so, make the data definitions really happen. Otherwise,
make them extern so other functions in the component can access them. */
#ifdef TX_SEMAPHORE_INIT
#define SEMAPHORE_DECLARE
#else
#define SEMAPHORE_DECLARE extern
#endif
/* Define the head pointer of the created semaphore list. */
SEMAPHORE_DECLARE TX_SEMAPHORE * _tx_semaphore_created_ptr;
/* Define the variable that holds the number of created semaphores. */
SEMAPHORE_DECLARE ULONG _tx_semaphore_created_count;
#ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
/* Define the total number of semaphore puts. */
SEMAPHORE_DECLARE ULONG _tx_semaphore_performance_put_count;
/* Define the total number of semaphore gets. */
SEMAPHORE_DECLARE ULONG _tx_semaphore_performance_get_count;
/* Define the total number of semaphore suspensions. */
SEMAPHORE_DECLARE ULONG _tx_semaphore_performance_suspension_count;
/* Define the total number of semaphore timeouts. */
SEMAPHORE_DECLARE ULONG _tx_semaphore_performance_timeout_count;
#endif
/* Define default post semaphore delete macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_SEMAPHORE_DELETE_PORT_COMPLETION
#define TX_SEMAPHORE_DELETE_PORT_COMPLETION(s)
#endif
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+146
View File
@@ -0,0 +1,146 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Block Memory */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_block_pool.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_block_pool_info_get PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
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)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_BLOCK_POOL_INFO_GET, pool_ptr, 0, 0, 0, TX_TRACE_BLOCK_POOL_EVENTS)
/* Log this kernel call. */
TX_EL_BLOCK_POOL_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* 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;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
+129
View File
@@ -0,0 +1,129 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Block Pool */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_block_pool.h"
#ifndef TX_INLINE_INITIALIZATION
/* Locate block pool component data in this file. */
/* Define the head pointer of the created block pool list. */
TX_BLOCK_POOL * _tx_block_pool_created_ptr;
/* Define the variable that holds the number of created block pools. */
ULONG _tx_block_pool_created_count;
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
/* Define the total number of block allocates. */
ULONG _tx_block_pool_performance_allocate_count;
/* Define the total number of block releases. */
ULONG _tx_block_pool_performance_release_count;
/* Define the total number of block pool suspensions. */
ULONG _tx_block_pool_performance_suspension_count;
/* Define the total number of block pool timeouts. */
ULONG _tx_block_pool_performance_timeout_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_block pool_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the block pool component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_block_pool_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created block pools list and the
number of block pools created. */
_tx_block_pool_created_ptr = TX_NULL;
_tx_block_pool_created_count = TX_EMPTY;
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
/* Initialize block pool performance counters. */
_tx_block_pool_performance_allocate_count = ((ULONG) 0);
_tx_block_pool_performance_release_count = ((ULONG) 0);
_tx_block_pool_performance_suspension_count = ((ULONG) 0);
_tx_block_pool_performance_timeout_count = ((ULONG) 0);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,173 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Block Memory */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_block_pool.h"
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
#include "tx_trace.h"
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_block_pool_performance_system_info_get PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_block_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, ULONG *suspensions, ULONG *timeouts)
{
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_BLOCK_POOL__PERFORMANCE_SYSTEM_INFO_GET, 0, 0, 0, 0, TX_TRACE_BLOCK_POOL_EVENTS)
/* Log this kernel call. */
TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* 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;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
#else
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
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+197
View File
@@ -0,0 +1,197 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Byte Pool */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_byte_pool.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_byte_pool_create PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size)
{
TX_INTERRUPT_SAVE_AREA
UCHAR *block_ptr;
UCHAR **block_indirect_ptr;
UCHAR *temp_ptr;
TX_BYTE_POOL *next_pool;
TX_BYTE_POOL *previous_pool;
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
an ULONG. */
pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE));
/* Setup the basic byte pool fields. */
pool_ptr -> tx_byte_pool_name = name_ptr;
/* Save the start and size of the pool. */
pool_ptr -> tx_byte_pool_start = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
pool_ptr -> tx_byte_pool_size = pool_size;
/* Setup memory list to the beginning as well as the search pointer. */
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
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);
/* 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. */
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;
block_ptr = TX_UCHAR_POINTER_SUB(block_ptr, (sizeof(UCHAR *)));
block_indirect_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr);
*block_indirect_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
/* Now setup the large available block in the pool. */
temp_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
block_indirect_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(temp_ptr);
*block_indirect_ptr = block_ptr;
block_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
block_ptr = TX_UCHAR_POINTER_ADD(block_ptr, (sizeof(UCHAR *)));
free_ptr = TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(block_ptr);
*free_ptr = TX_BYTE_BLOCK_FREE;
/* Clear the owner id. */
pool_ptr -> tx_byte_pool_owner = TX_NULL;
/* Disable interrupts to place the byte pool on the created list. */
TX_DISABLE
/* Setup the byte pool ID to make it valid. */
pool_ptr -> tx_byte_pool_id = TX_BYTE_POOL_ID;
/* Place the byte pool on the list of created byte pools. First,
check for an empty list. */
if (_tx_byte_pool_created_count == TX_EMPTY)
{
/* The created byte pool list is empty. Add byte pool to empty list. */
_tx_byte_pool_created_ptr = pool_ptr;
pool_ptr -> tx_byte_pool_created_next = pool_ptr;
pool_ptr -> tx_byte_pool_created_previous = pool_ptr;
}
else
{
/* This list is not NULL, add to the end of the list. */
next_pool = _tx_byte_pool_created_ptr;
previous_pool = next_pool -> tx_byte_pool_created_previous;
/* Place the new byte pool in the list. */
next_pool -> tx_byte_pool_created_previous = pool_ptr;
previous_pool -> tx_byte_pool_created_next = pool_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;
}
/* 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)
/* If trace is enabled, register this object. */
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_BYTE_POOL, pool_ptr, name_ptr, pool_size, 0)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_BYTE_POOL_CREATE, pool_ptr, TX_POINTER_TO_ULONG_CONVERT(pool_start), pool_size, TX_POINTER_TO_ULONG_CONVERT(&block_ptr), TX_TRACE_BYTE_POOL_EVENTS)
/* Log this kernel call. */
TX_EL_BYTE_POOL_CREATE_INSERT
/* Restore interrupts. */
TX_RESTORE
/* Return TX_SUCCESS. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
+146
View File
@@ -0,0 +1,146 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Byte Memory */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_byte_pool.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_byte_pool_info_get PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
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)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_BYTE_POOL_INFO_GET, pool_ptr, 0, 0, 0, TX_TRACE_BYTE_POOL_EVENTS)
/* Log this kernel call. */
TX_EL_BYTE_POOL_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* 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;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
+147
View File
@@ -0,0 +1,147 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Byte Pool */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_byte_pool.h"
#ifndef TX_INLINE_INITIALIZATION
/* Locate byte pool component data in this file. */
/* Define the head pointer of the created byte pool list. */
TX_BYTE_POOL * _tx_byte_pool_created_ptr;
/* Define the variable that holds the number of created byte pools. */
ULONG _tx_byte_pool_created_count;
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
/* Define the total number of allocates. */
ULONG _tx_byte_pool_performance_allocate_count;
/* Define the total number of releases. */
ULONG _tx_byte_pool_performance_release_count;
/* Define the total number of adjacent memory fragment merges. */
ULONG _tx_byte_pool_performance_merge_count;
/* Define the total number of memory fragment splits. */
ULONG _tx_byte_pool_performance_split_count;
/* Define the total number of memory fragments searched during allocation. */
ULONG _tx_byte_pool_performance_search_count;
/* Define the total number of byte pool suspensions. */
ULONG _tx_byte_pool_performance_suspension_count;
/* Define the total number of byte pool timeouts. */
ULONG _tx_byte_pool_performance_timeout_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_byte_pool_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the byte pool component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_byte_pool_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created byte pools list and the
number of byte pools created. */
_tx_byte_pool_created_ptr = TX_NULL;
_tx_byte_pool_created_count = TX_EMPTY;
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
/* Initialize byte pool performance counters. */
_tx_byte_pool_performance_allocate_count = ((ULONG) 0);
_tx_byte_pool_performance_release_count = ((ULONG) 0);
_tx_byte_pool_performance_merge_count = ((ULONG) 0);
_tx_byte_pool_performance_split_count = ((ULONG) 0);
_tx_byte_pool_performance_search_count = ((ULONG) 0);
_tx_byte_pool_performance_suspension_count = ((ULONG) 0);
_tx_byte_pool_performance_timeout_count = ((ULONG) 0);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+141
View File
@@ -0,0 +1,141 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_event_flags.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_create PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr)
{
TX_INTERRUPT_SAVE_AREA
TX_EVENT_FLAGS_GROUP *next_group;
TX_EVENT_FLAGS_GROUP *previous_group;
/* Initialize event flags control block to all zeros. */
TX_MEMSET(group_ptr, 0, (sizeof(TX_EVENT_FLAGS_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
/* Setup the event flags ID to make it valid. */
group_ptr -> tx_event_flags_group_id = TX_EVENT_FLAGS_ID;
/* Place the group on the list of created event flag groups. First,
check for an empty list. */
if (_tx_event_flags_created_count == TX_EMPTY)
{
/* The created event flags list is empty. Add event flag group to empty list. */
_tx_event_flags_created_ptr = group_ptr;
group_ptr -> tx_event_flags_group_created_next = group_ptr;
group_ptr -> tx_event_flags_group_created_previous = group_ptr;
}
else
{
/* This list is not NULL, add to the end of the list. */
next_group = _tx_event_flags_created_ptr;
previous_group = next_group -> tx_event_flags_group_created_previous;
/* Place the new event flag group in the list. */
next_group -> tx_event_flags_group_created_previous = group_ptr;
previous_group -> tx_event_flags_group_created_next = group_ptr;
/* 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;
}
/* 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)
/* If trace is enabled, register this object. */
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_EVENT_FLAGS, group_ptr, name_ptr, 0, 0)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_EVENT_FLAGS_CREATE, group_ptr, TX_POINTER_TO_ULONG_CONVERT(&next_group), 0, 0, TX_TRACE_EVENT_FLAGS_EVENTS)
/* Log this kernel call. */
TX_EL_EVENT_FLAGS_CREATE_INSERT
/* Restore interrupts. */
TX_RESTORE
/* Return TX_SUCCESS. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+143
View File
@@ -0,0 +1,143 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_event_flags.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_info_get PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
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)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_EVENT_FLAGS_INFO_GET, group_ptr, 0, 0, 0, TX_TRACE_EVENT_FLAGS_EVENTS)
/* Log this kernel call. */
TX_EL_EVENT_FLAGS_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the name of the event flag group. */
if (name != TX_NULL)
{
*name = group_ptr -> tx_event_flags_group_name;
}
/* Retrieve the current event flags in the event flag group. */
if (current_flags != TX_NULL)
{
/* Pickup the current flags and apply delayed clearing. */
*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
/* Return completion status. */
return(TX_SUCCESS);
}
+130
View File
@@ -0,0 +1,130 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_event_flags.h"
#ifndef TX_INLINE_INITIALIZATION
/* Locate event flags component data in this file. */
/* Define the head pointer of the created event flags list. */
TX_EVENT_FLAGS_GROUP * _tx_event_flags_created_ptr;
/* Define the variable that holds the number of created event flag groups. */
ULONG _tx_event_flags_created_count;
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
/* Define the total number of event flag sets. */
ULONG _tx_event_flags_performance_set_count;
/* Define the total number of event flag gets. */
ULONG _tx_event_flags_performance_get_count;
/* Define the total number of event flag suspensions. */
ULONG _tx_event_flags_performance_suspension_count;
/* Define the total number of event flag timeouts. */
ULONG _tx_event_flags_performance_timeout_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the event flags component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_event_flags_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created event flags list and the
number of event flags created. */
_tx_event_flags_created_ptr = TX_NULL;
_tx_event_flags_created_count = TX_EMPTY;
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
/* Initialize event flags performance counters. */
_tx_event_flags_performance_set_count = ((ULONG) 0);
_tx_event_flags_performance_get_count = ((ULONG) 0);
_tx_event_flags_performance_suspension_count = ((ULONG) 0);
_tx_event_flags_performance_timeout_count = ((ULONG) 0);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,174 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_event_flags.h"
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
#include "tx_trace.h"
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_performance_system_info_get PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
{
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET, 0, 0, 0, 0, TX_TRACE_EVENT_FLAGS_EVENTS)
/* Log this kernel call. */
TX_EL_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* 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;
/* Access input arguments just for the sake of lint, MISRA, etc. */
if (sets != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (gets != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (suspensions != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (timeouts != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
/* Return completion status. */
return(status);
#endif
}
File diff suppressed because it is too large Load Diff
+107
View File
@@ -0,0 +1,107 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Event Flags */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_event_flags.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_event_flags_set_notify PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr))
{
#ifdef TX_DISABLE_NOTIFY_CALLBACKS
TX_EVENT_FLAGS_GROUP_NOT_USED(group_ptr);
TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED(events_set_notify);
/* Feature is not enabled, return error. */
return(TX_FEATURE_NOT_ENABLED);
#else
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* Make entry in event log. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_EVENT_FLAGS_SET_NOTIFY, group_ptr, 0, 0, 0, TX_TRACE_EVENT_FLAGS_EVENTS)
/* Make entry in event log. */
TX_EL_EVENT_FLAGS_SET_NOTIFY_INSERT
/* Setup event flag group set notification callback function. */
group_ptr -> tx_event_flags_group_set_notify = events_set_notify;
/* Restore interrupts. */
TX_RESTORE
/* Return success to caller. */
return(TX_SUCCESS);
#endif
}
+150
View File
@@ -0,0 +1,150 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Initialize */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
/* Determine if in-line initialization is required. */
#ifdef TX_INLINE_INITIALIZATION
#define TX_INVOKE_INLINE_INITIALIZATION
#endif
#include "tx_initialize.h"
#include "tx_thread.h"
#include "tx_timer.h"
#include "tx_semaphore.h"
#include "tx_queue.h"
#include "tx_event_flags.h"
#include "tx_mutex.h"
#include "tx_block_pool.h"
#include "tx_byte_pool.h"
/* 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
to the application's system definition function. */
VOID *_tx_initialize_unused_memory;
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_initialize_high_level PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_initialize_high_level(VOID)
{
/* Initialize event tracing, if enabled. */
TX_TRACE_INITIALIZE
/* Initialize the event log, if enabled. */
TX_EL_INITIALIZE
/* Call the thread control initialization function. */
_tx_thread_initialize();
#ifndef TX_NO_TIMER
/* Call the timer control initialization function. */
_tx_timer_initialize();
#endif
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Call the semaphore initialization function. */
_tx_semaphore_initialize();
/* Call the queue initialization function. */
_tx_queue_initialize();
/* Call the event flag initialization function. */
_tx_event_flags_initialize();
/* Call the block pool initialization function. */
_tx_block_pool_initialize();
/* Call the byte pool initialization function. */
_tx_byte_pool_initialize();
/* Call the mutex initialization function. */
_tx_mutex_initialize();
#endif
}
+148
View File
@@ -0,0 +1,148 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Initialize */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_initialize.h"
#include "tx_thread.h"
#include "tx_timer.h"
/* Define any port-specific scheduling data structures. */
TX_PORT_SPECIFIC_DATA
#ifdef TX_SAFETY_CRITICAL
TX_SAFETY_CRITICAL_EXCEPTION_HANDLER
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_initialize_kernel_enter PORTABLE C */
/* 6.0 */
/* 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_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 */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_initialize_kernel_enter(VOID)
{
/* Determine if the compiler has pre-initialized ThreadX. */
if (_tx_thread_system_state != TX_INITIALIZE_ALMOST_DONE)
{
/* 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
later used to represent interrupt nesting. */
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
/* Call any port specific preprocessing. */
TX_PORT_SPECIFIC_PRE_INITIALIZATION
/* Invoke the low-level initialization to handle all processor specific
initialization issues. */
_tx_initialize_low_level();
/* Invoke the high-level initialization to exercise all of the
ThreadX components and the application's initialization
function. */
_tx_initialize_high_level();
/* Call any port specific post-processing. */
TX_PORT_SPECIFIC_POST_INITIALIZATION
}
/* 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
later used to represent interrupt nesting. */
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
/* Call the application provided initialization function. Pass the
first available memory address to it. */
tx_application_define(_tx_initialize_unused_memory);
/* Set the system state in preparation for entering the thread
scheduler. */
_tx_thread_system_state = TX_INITIALIZE_IS_FINISHED;
/* Call any port specific pre-scheduler processing. */
TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION
/* Enter the scheduling loop to start executing threads! */
_tx_thread_schedule();
#ifdef TX_SAFETY_CRITICAL
/* If we ever get here, raise safety critical exception. */
TX_SAFETY_CRITICAL_EXCEPTION(__FILE__, __LINE__, 0);
#endif
}
+100
View File
@@ -0,0 +1,100 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Initialize */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_initialize.h"
#include "tx_thread.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_initialize_kernel_setup PORTABLE C */
/* 6.0 */
/* 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_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 */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
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
later used to represent interrupt nesting. */
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
/* Call any port specific preprocessing. */
TX_PORT_SPECIFIC_PRE_INITIALIZATION
/* Invoke the low-level initialization to handle all processor specific
initialization issues. */
_tx_initialize_low_level();
/* Invoke the high-level initialization to exercise all of the
ThreadX components and the application's initialization
function. */
_tx_initialize_high_level();
/* Call any port specific post-processing. */
TX_PORT_SPECIFIC_POST_INITIALIZATION
/* Set the system state to indicate initialization is almost done. */
_tx_thread_system_state = TX_INITIALIZE_ALMOST_DONE;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+146
View File
@@ -0,0 +1,146 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Mutex */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_thread.h"
#include "tx_trace.h"
#include "tx_mutex.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_mutex_create PORTABLE C */
/* 6.0 */
/* 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 */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit)
{
TX_INTERRUPT_SAVE_AREA
TX_MUTEX *next_mutex;
TX_MUTEX *previous_mutex;
/* Initialize mutex control block to all zeros. */
TX_MEMSET(mutex_ptr, 0, (sizeof(TX_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
/* Setup the mutex ID to make it valid. */
mutex_ptr -> tx_mutex_id = TX_MUTEX_ID;
/* Setup the thread mutex release function pointer. */
_tx_thread_mutex_release = &(_tx_mutex_thread_release);
/* Place the mutex on the list of created mutexes. First,
check for an empty list. */
if (_tx_mutex_created_count == TX_EMPTY)
{
/* The created mutex list is empty. Add mutex to empty list. */
_tx_mutex_created_ptr = mutex_ptr;
mutex_ptr -> tx_mutex_created_next = mutex_ptr;
mutex_ptr -> tx_mutex_created_previous = mutex_ptr;
}
else
{
/* This list is not NULL, add to the end of the list. */
next_mutex = _tx_mutex_created_ptr;
previous_mutex = next_mutex -> tx_mutex_created_previous;
/* Place the new mutex in the list. */
next_mutex -> tx_mutex_created_previous = mutex_ptr;
previous_mutex -> tx_mutex_created_next = mutex_ptr;
/* 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;
}
/* Increment the ownership count. */
_tx_mutex_created_count++;
/* Optional mutex create extended processing. */
TX_MUTEX_CREATE_EXTENSION(mutex_ptr)
/* If trace is enabled, register this object. */
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_MUTEX, mutex_ptr, name_ptr, inherit, 0)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_MUTEX_CREATE, mutex_ptr, inherit, TX_POINTER_TO_ULONG_CONVERT(&next_mutex), 0, TX_TRACE_MUTEX_EVENTS)
/* Log this kernel call. */
TX_EL_MUTEX_CREATE_INSERT
/* Restore interrupts. */
TX_RESTORE
/* Return TX_SUCCESS. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+147
View File
@@ -0,0 +1,147 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Mutex */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_mutex.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_mutex_info_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrieves information from the specified mutex. */
/* */
/* INPUT */
/* */
/* mutex_ptr Pointer to mutex control block */
/* name Destination for the mutex name */
/* count Destination for the owner count */
/* owner Destination for the owner's */
/* thread control block pointer */
/* first_suspended Destination for pointer of first */
/* thread suspended on the mutex */
/* suspended_count Destination for suspended count */
/* next_mutex Destination for pointer to next */
/* mutex on the created list */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_MUTEX **next_mutex)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_MUTEX_INFO_GET, mutex_ptr, 0, 0, 0, TX_TRACE_MUTEX_EVENTS)
/* Log this kernel call. */
TX_EL_MUTEX_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the name of the mutex. */
if (name != TX_NULL)
{
*name = mutex_ptr -> tx_mutex_name;
}
/* Retrieve the current ownership count of the mutex. */
if (count != TX_NULL)
{
*count = ((ULONG) mutex_ptr -> tx_mutex_ownership_count);
}
/* Retrieve the current owner of the mutex. */
if (owner != TX_NULL)
{
*owner = mutex_ptr -> tx_mutex_owner;
}
/* Retrieve the first thread suspended on this mutex. */
if (first_suspended != TX_NULL)
{
*first_suspended = mutex_ptr -> tx_mutex_suspension_list;
}
/* Retrieve the number of threads suspended on this mutex. */
if (suspended_count != TX_NULL)
{
*suspended_count = (ULONG) mutex_ptr -> tx_mutex_suspended_count;
}
/* Retrieve the pointer to the next mutex created. */
if (next_mutex != TX_NULL)
{
*next_mutex = mutex_ptr -> tx_mutex_created_next;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
+141
View File
@@ -0,0 +1,141 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Mutex */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_mutex.h"
#ifndef TX_INLINE_INITIALIZATION
/* Locate mutex component data in this file. */
/* Define the head pointer of the created mutex list. */
TX_MUTEX * _tx_mutex_created_ptr;
/* Define the variable that holds the number of created mutexes. */
ULONG _tx_mutex_created_count;
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
/* Define the total number of mutex puts. */
ULONG _tx_mutex_performance_put_count;
/* Define the total number of mutex gets. */
ULONG _tx_mutex_performance_get_count;
/* Define the total number of mutex suspensions. */
ULONG _tx_mutex_performance_suspension_count;
/* Define the total number of mutex timeouts. */
ULONG _tx_mutex_performance_timeout_count;
/* Define the total number of priority inversions. */
ULONG _tx_mutex_performance_priority_inversion_count;
/* Define the total number of priority inheritance conditions. */
ULONG _tx_mutex_performance__priority_inheritance_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_mutex_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the mutex component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_mutex_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created mutexes list and the
number of mutexes created. */
_tx_mutex_created_ptr = TX_NULL;
_tx_mutex_created_count = TX_EMPTY;
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
/* Initialize the mutex performance counters. */
_tx_mutex_performance_put_count = ((ULONG) 0);
_tx_mutex_performance_get_count = ((ULONG) 0);
_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);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+170
View File
@@ -0,0 +1,170 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Queue */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_queue.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_queue_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a message queue. The message size and depth */
/* of the queue is specified by the caller. */
/* */
/* INPUT */
/* */
/* queue_ptr Pointer to queue control block */
/* name_ptr Pointer to queue name */
/* message_size Size of each queue message */
/* queue_start Starting address of the queue area*/
/* queue_size Number of bytes in the queue */
/* */
/* OUTPUT */
/* */
/* TX_SUCCESS Successful completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size)
{
TX_INTERRUPT_SAVE_AREA
UINT capacity;
UINT used_words;
TX_QUEUE *next_queue;
TX_QUEUE *previous_queue;
/* Initialize queue control block to all zeros. */
TX_MEMSET(queue_ptr, 0, (sizeof(TX_QUEUE)));
/* Setup the basic queue fields. */
queue_ptr -> tx_queue_name = name_ptr;
/* Save the message size in the control block. */
queue_ptr -> tx_queue_message_size = message_size;
/* Determine how many messages will fit in the queue area and the number
of ULONGs used. */
capacity = (UINT) (queue_size / ((ULONG) (((ULONG) message_size) * (sizeof(ULONG)))));
used_words = capacity * message_size;
/* Save the starting address and calculate the ending address of
the queue. Note that the ending address is really one past the
end! */
queue_ptr -> tx_queue_start = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
queue_ptr -> tx_queue_end = TX_ULONG_POINTER_ADD(queue_ptr -> tx_queue_start, used_words);
/* Set the read and write pointers to the beginning of the queue
area. */
queue_ptr -> tx_queue_read = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
queue_ptr -> tx_queue_write = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
/* Setup the number of enqueued messages and the number of message
slots available in the queue. */
queue_ptr -> tx_queue_available_storage = (UINT) capacity;
queue_ptr -> tx_queue_capacity = (UINT) capacity;
/* Disable interrupts to put the queue on the created list. */
TX_DISABLE
/* Setup the queue ID to make it valid. */
queue_ptr -> tx_queue_id = TX_QUEUE_ID;
/* Place the queue on the list of created queues. First,
check for an empty list. */
if (_tx_queue_created_count == TX_EMPTY)
{
/* The created queue list is empty. Add queue to empty list. */
_tx_queue_created_ptr = queue_ptr;
queue_ptr -> tx_queue_created_next = queue_ptr;
queue_ptr -> tx_queue_created_previous = queue_ptr;
}
else
{
/* This list is not NULL, add to the end of the list. */
next_queue = _tx_queue_created_ptr;
previous_queue = next_queue -> tx_queue_created_previous;
/* Place the new queue in the list. */
next_queue -> tx_queue_created_previous = queue_ptr;
previous_queue -> tx_queue_created_next = queue_ptr;
/* Setup this queues's created links. */
queue_ptr -> tx_queue_created_previous = previous_queue;
queue_ptr -> tx_queue_created_next = next_queue;
}
/* Increment the created queue count. */
_tx_queue_created_count++;
/* Optional queue create extended processing. */
TX_QUEUE_CREATE_EXTENSION(queue_ptr)
/* If trace is enabled, register this object. */
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_QUEUE, queue_ptr, name_ptr, queue_size, message_size)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_CREATE, queue_ptr, message_size, TX_POINTER_TO_ULONG_CONVERT(queue_start), queue_size, TX_TRACE_QUEUE_EVENTS)
/* Log this kernel call. */
TX_EL_QUEUE_CREATE_INSERT
/* Restore interrupts. */
TX_RESTORE
/* Return TX_SUCCESS. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+145
View File
@@ -0,0 +1,145 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Queue */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_queue.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_queue_info_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrieves information from the specified queue. */
/* */
/* INPUT */
/* */
/* queue_ptr Pointer to queue control block */
/* name Destination for the queue name */
/* enqueued Destination for enqueued count */
/* available_storage Destination for available storage */
/* first_suspended Destination for pointer of first */
/* thread suspended on this queue */
/* suspended_count Destination for suspended count */
/* next_queue Destination for pointer to next */
/* queue on the created list */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_INFO_GET, queue_ptr, 0, 0, 0, TX_TRACE_QUEUE_EVENTS)
/* Log this kernel call. */
TX_EL_QUEUE_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the name of the queue. */
if (name != TX_NULL)
{
*name = queue_ptr -> tx_queue_name;
}
/* Retrieve the number of messages currently in the queue. */
if (enqueued != TX_NULL)
{
*enqueued = (ULONG) queue_ptr -> tx_queue_enqueued;
}
/* Retrieve the number of messages that will still fit in the queue. */
if (available_storage != TX_NULL)
{
*available_storage = (ULONG) queue_ptr -> tx_queue_available_storage;
}
/* Retrieve the first thread suspended on this queue. */
if (first_suspended != TX_NULL)
{
*first_suspended = queue_ptr -> tx_queue_suspension_list;
}
/* Retrieve the number of threads suspended on this queue. */
if (suspended_count != TX_NULL)
{
*suspended_count = (ULONG) queue_ptr -> tx_queue_suspended_count;
}
/* Retrieve the pointer to the next queue created. */
if (next_queue != TX_NULL)
{
*next_queue = queue_ptr -> tx_queue_created_next;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
+138
View File
@@ -0,0 +1,138 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Queue */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_queue.h"
#ifndef TX_INLINE_INITIALIZATION
/* Define the head pointer of the created queue list. */
TX_QUEUE * _tx_queue_created_ptr;
/* Define the variable that holds the number of created queues. */
ULONG _tx_queue_created_count;
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
/* Define the total number of messages sent. */
ULONG _tx_queue_performance_messages_sent_count;
/* Define the total number of messages received. */
ULONG _tx_queue_performance__messages_received_count;
/* Define the total number of queue empty suspensions. */
ULONG _tx_queue_performance_empty_suspension_count;
/* Define the total number of queue full suspensions. */
ULONG _tx_queue_performance_full_suspension_count;
/* Define the total number of queue full errors. */
ULONG _tx_queue_performance_full_error_count;
/* Define the total number of queue timeouts. */
ULONG _tx_queue_performance_timeout_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_queue_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the queue component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_queue_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created queue list and the
number of queues created. */
_tx_queue_created_ptr = TX_NULL;
_tx_queue_created_count = TX_EMPTY;
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
/* Initialize the queue performance counters. */
_tx_queue_performance_messages_sent_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);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+107
View File
@@ -0,0 +1,107 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Queue */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_queue.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_queue_send_notify PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function registers an application callback function that is */
/* called whenever a messages is sent to this queue. */
/* */
/* INPUT */
/* */
/* queue_ptr Pointer to queue control block*/
/* queue_send_notify Application callback function */
/* (TX_NULL disables notify) */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr))
{
#ifdef TX_DISABLE_NOTIFY_CALLBACKS
TX_QUEUE_NOT_USED(queue_ptr);
TX_QUEUE_SEND_NOTIFY_NOT_USED(queue_send_notify);
/* Feature is not enabled, return error. */
return(TX_FEATURE_NOT_ENABLED);
#else
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* Make entry in event log. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_SEND_NOTIFY, queue_ptr, 0, 0, 0, TX_TRACE_QUEUE_EVENTS)
/* Make entry in event log. */
TX_EL_QUEUE_SEND_NOTIFY_INSERT
/* Setup queue send notification callback function. */
queue_ptr -> tx_queue_send_notify = queue_send_notify;
/* Restore interrupts. */
TX_RESTORE
/* Return success to caller. */
return(TX_SUCCESS);
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+142
View File
@@ -0,0 +1,142 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_semaphore.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_semaphore_create PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a counting semaphore with the initial count */
/* specified in this call. */
/* */
/* INPUT */
/* */
/* semaphore_ptr Pointer to semaphore control block*/
/* name_ptr Pointer to semaphore name */
/* initial_count Initial semaphore count */
/* */
/* OUTPUT */
/* */
/* TX_SUCCESS Successful completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count)
{
TX_INTERRUPT_SAVE_AREA
TX_SEMAPHORE *next_semaphore;
TX_SEMAPHORE *previous_semaphore;
/* Initialize semaphore control block to all zeros. */
TX_MEMSET(semaphore_ptr, 0, (sizeof(TX_SEMAPHORE)));
/* Setup the basic semaphore fields. */
semaphore_ptr -> tx_semaphore_name = name_ptr;
semaphore_ptr -> tx_semaphore_count = initial_count;
/* Disable interrupts to place the semaphore on the created list. */
TX_DISABLE
/* Setup the semaphore ID to make it valid. */
semaphore_ptr -> tx_semaphore_id = TX_SEMAPHORE_ID;
/* Place the semaphore on the list of created semaphores. First,
check for an empty list. */
if (_tx_semaphore_created_count == TX_EMPTY)
{
/* The created semaphore list is empty. Add semaphore to empty list. */
_tx_semaphore_created_ptr = semaphore_ptr;
semaphore_ptr -> tx_semaphore_created_next = semaphore_ptr;
semaphore_ptr -> tx_semaphore_created_previous = semaphore_ptr;
}
else
{
/* This list is not NULL, add to the end of the list. */
next_semaphore = _tx_semaphore_created_ptr;
previous_semaphore = next_semaphore -> tx_semaphore_created_previous;
/* Place the new semaphore in the list. */
next_semaphore -> tx_semaphore_created_previous = semaphore_ptr;
previous_semaphore -> tx_semaphore_created_next = semaphore_ptr;
/* Setup this semaphore's next and previous created links. */
semaphore_ptr -> tx_semaphore_created_previous = previous_semaphore;
semaphore_ptr -> tx_semaphore_created_next = next_semaphore;
}
/* Increment the created count. */
_tx_semaphore_created_count++;
/* Optional semaphore create extended processing. */
TX_SEMAPHORE_CREATE_EXTENSION(semaphore_ptr)
/* If trace is enabled, register this object. */
TX_TRACE_OBJECT_REGISTER(TX_TRACE_OBJECT_TYPE_SEMAPHORE, semaphore_ptr, name_ptr, initial_count, 0)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_SEMAPHORE_CREATE, semaphore_ptr, initial_count, TX_POINTER_TO_ULONG_CONVERT(&next_semaphore), 0, TX_TRACE_SEMAPHORE_EVENTS)
/* Log this kernel call. */
TX_EL_SEMAPHORE_CREATE_INSERT
/* Restore interrupts. */
TX_RESTORE
/* Return TX_SUCCESS. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+139
View File
@@ -0,0 +1,139 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_semaphore.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_semaphore_info_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrieves information from the specified semaphore. */
/* */
/* INPUT */
/* */
/* semaphore_ptr Pointer to semaphore control block*/
/* name Destination for the semaphore name*/
/* current_value Destination for current value of */
/* the semaphore */
/* first_suspended Destination for pointer of first */
/* thread suspended on semaphore */
/* suspended_count Destination for suspended count */
/* next_semaphore Destination for pointer to next */
/* semaphore on the created list */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_SEMAPHORE **next_semaphore)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_SEMAPHORE_INFO_GET, semaphore_ptr, 0, 0, 0, TX_TRACE_SEMAPHORE_EVENTS)
/* Log this kernel call. */
TX_EL_SEMAPHORE_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the name of the semaphore. */
if (name != TX_NULL)
{
*name = semaphore_ptr -> tx_semaphore_name;
}
/* Retrieve the current value of the semaphore. */
if (current_value != TX_NULL)
{
*current_value = semaphore_ptr -> tx_semaphore_count;
}
/* Retrieve the first thread suspended on this semaphore. */
if (first_suspended != TX_NULL)
{
*first_suspended = semaphore_ptr -> tx_semaphore_suspension_list;
}
/* Retrieve the number of threads suspended on this semaphore. */
if (suspended_count != TX_NULL)
{
*suspended_count = (ULONG) semaphore_ptr -> tx_semaphore_suspended_count;
}
/* Retrieve the pointer to the next semaphore created. */
if (next_semaphore != TX_NULL)
{
*next_semaphore = semaphore_ptr -> tx_semaphore_created_next;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
+129
View File
@@ -0,0 +1,129 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_semaphore.h"
#ifndef TX_INLINE_INITIALIZATION
/* Locate semaphore component data in this file. */
/* Define the head pointer of the created semaphore list. */
TX_SEMAPHORE * _tx_semaphore_created_ptr;
/* Define the variable that holds the number of created semaphores. */
ULONG _tx_semaphore_created_count;
#ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
/* Define the total number of semaphore puts. */
ULONG _tx_semaphore_performance_put_count;
/* Define the total number of semaphore gets. */
ULONG _tx_semaphore_performance_get_count;
/* Define the total number of semaphore suspensions. */
ULONG _tx_semaphore_performance_suspension_count;
/* Define the total number of semaphore timeouts. */
ULONG _tx_semaphore_performance_timeout_count;
#endif
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_semaphore_initialize PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function initializes the various control data structures for */
/* the semaphore component. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* _tx_initialize_high_level High level initialization */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
VOID _tx_semaphore_initialize(VOID)
{
#ifndef TX_DISABLE_REDUNDANT_CLEARING
/* Initialize the head pointer of the created semaphores list and the
number of semaphores created. */
_tx_semaphore_created_ptr = TX_NULL;
_tx_semaphore_created_count = TX_EMPTY;
#ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
/* Initialize semaphore performance counters. */
_tx_semaphore_performance_put_count = ((ULONG) 0);
_tx_semaphore_performance_get_count = ((ULONG) 0);
_tx_semaphore_performance_suspension_count = ((ULONG) 0);
_tx_semaphore_performance_timeout_count = ((ULONG) 0);
#endif
#endif
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,174 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_semaphore.h"
#ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
#include "tx_trace.h"
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_semaphore_performance_system_info_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrieves system semaphore performance information. */
/* */
/* INPUT */
/* */
/* puts Destination for total number of */
/* semaphore puts */
/* gets Destination for total number of */
/* semaphore gets */
/* suspensions Destination for total number of */
/* semaphore suspensions */
/* timeouts Destination for total number of */
/* timeouts */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_semaphore_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts)
{
#ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_SEMAPHORE__PERFORMANCE_SYSTEM_INFO_GET, 0, 0, 0, 0, TX_TRACE_SEMAPHORE_EVENTS)
/* Log this kernel call. */
TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the total number of semaphore puts. */
if (puts != TX_NULL)
{
*puts = _tx_semaphore_performance_put_count;
}
/* Retrieve the total number of semaphore gets. */
if (gets != TX_NULL)
{
*gets = _tx_semaphore_performance_get_count;
}
/* Retrieve the total number of semaphore suspensions. */
if (suspensions != TX_NULL)
{
*suspensions = _tx_semaphore_performance_suspension_count;
}
/* Retrieve the total number of semaphore timeouts. */
if (timeouts != TX_NULL)
{
*timeouts = _tx_semaphore_performance_timeout_count;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
#else
UINT status;
/* Access input arguments just for the sake of lint, MISRA, etc. */
if (puts != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (gets != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (suspensions != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else if (timeouts != TX_NULL)
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
else
{
/* Not enabled, return error. */
status = TX_FEATURE_NOT_ENABLED;
}
/* Return completion status. */
return(status);
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+107
View File
@@ -0,0 +1,107 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Semaphore */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_semaphore.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_semaphore_put_notify PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function registers an application callback function that is */
/* called whenever the this semaphore is put. */
/* */
/* INPUT */
/* */
/* semaphore_ptr Pointer to semaphore */
/* semaphore_put_notify Application callback function */
/* (TX_NULL disables notify) */
/* */
/* OUTPUT */
/* */
/* status Service return status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr))
{
#ifdef TX_DISABLE_NOTIFY_CALLBACKS
TX_SEMAPHORE_NOT_USED(semaphore_ptr);
TX_SEMAPHORE_PUT_NOTIFY_NOT_USED(semaphore_put_notify);
/* Feature is not enabled, return error. */
return(TX_FEATURE_NOT_ENABLED);
#else
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* Make entry in event log. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_SEMAPHORE_PUT_NOTIFY, semaphore_ptr, 0, 0, 0, TX_TRACE_SEMAPHORE_EVENTS)
/* Make entry in event log. */
TX_EL_SEMAPHORE_PUT_NOTIFY_INSERT
/* Setup semaphore put notification callback function. */
semaphore_ptr -> tx_semaphore_put_notify = semaphore_put_notify;
/* Restore interrupts. */
TX_RESTORE
/* Return success to caller. */
return(TX_SUCCESS);
#endif
}
File diff suppressed because it is too large Load Diff
+166
View File
@@ -0,0 +1,166 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_thread.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_delete PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function handles application delete thread requests. The */
/* thread to delete must be in a terminated or completed state, */
/* otherwise this function just returns an error code. */
/* */
/* INPUT */
/* */
/* thread_ptr Pointer to thread to suspend */
/* */
/* OUTPUT */
/* */
/* status Return completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_thread_delete(TX_THREAD *thread_ptr)
{
TX_INTERRUPT_SAVE_AREA
TX_THREAD *next_thread;
TX_THREAD *previous_thread;
UINT status;
/* Default status to success. */
status = TX_SUCCESS;
/* Lockout interrupts while the thread is being deleted. */
TX_DISABLE
/* Check for proper status of this thread to delete. */
if (thread_ptr -> tx_thread_state != TX_COMPLETED)
{
/* Now check for terminated state. */
if (thread_ptr -> tx_thread_state != TX_TERMINATED)
{
/* Restore interrupts. */
TX_RESTORE
/* Thread not completed or terminated - return an error! */
status = TX_DELETE_ERROR;
}
}
/* Determine if the delete operation is okay. */
if (status == TX_SUCCESS)
{
/* Yes, continue with deleting the thread. */
/* Perform any additional activities for tool or user purpose. */
TX_THREAD_DELETE_EXTENSION(thread_ptr)
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_DELETE, thread_ptr, TX_POINTER_TO_ULONG_CONVERT(&next_thread), 0, 0, TX_TRACE_THREAD_EVENTS)
/* If trace is enabled, unregister this object. */
TX_TRACE_OBJECT_UNREGISTER(thread_ptr)
/* Log this kernel call. */
TX_EL_THREAD_DELETE_INSERT
/* Unregister thread in the thread array structure. */
TX_EL_THREAD_UNREGISTER(thread_ptr)
/* Clear the thread ID to make it invalid. */
thread_ptr -> tx_thread_id = TX_CLEAR_ID;
/* Decrement the number of created threads. */
_tx_thread_created_count--;
/* See if the thread is the only one on the list. */
if (_tx_thread_created_count == TX_EMPTY)
{
/* Only created thread, just set the created list to NULL. */
_tx_thread_created_ptr = TX_NULL;
}
else
{
/* Otherwise, not the only created thread, link-up the neighbors. */
next_thread = thread_ptr -> tx_thread_created_next;
previous_thread = thread_ptr -> tx_thread_created_previous;
next_thread -> tx_thread_created_previous = previous_thread;
previous_thread -> tx_thread_created_next = next_thread;
/* See if we have to update the created list head pointer. */
if (_tx_thread_created_ptr == thread_ptr)
{
/* Yes, move the head pointer to the next link. */
_tx_thread_created_ptr = next_thread;
}
}
/* Execute Port-Specific completion processing. If needed, it is typically defined in tx_port.h. */
TX_THREAD_DELETE_PORT_COMPLETION(thread_ptr)
/* Restore interrupts. */
TX_RESTORE
}
/* Return completion status. */
return(status);
}
+109
View File
@@ -0,0 +1,109 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_thread.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_entry_exit_notify PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function registers an application entry/exit notification */
/* callback routine for the application. Once registered, the callback */
/* routine is called when the thread is initially entered and called */
/* again when the thread completes or is terminated. */
/* */
/* INPUT */
/* */
/* thread_ptr Pointer to thread */
/* thread_entry_exit_notify Pointer to notify callback */
/* function, TX_NULL to disable*/
/* */
/* OUTPUT */
/* */
/* status Service return status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT id))
{
#ifdef TX_DISABLE_NOTIFY_CALLBACKS
TX_THREAD_NOT_USED(thread_ptr);
TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(thread_entry_exit_notify);
/* Feature is not enabled, return error. */
return(TX_FEATURE_NOT_ENABLED);
#else
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* Make entry in event log. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_ENTRY_EXIT_NOTIFY, thread_ptr, thread_ptr -> tx_thread_state, 0, 0, TX_TRACE_THREAD_EVENTS)
/* Make entry in event log. */
TX_EL_THREAD_ENTRY_EXIT_NOTIFY_INSERT
/* Setup thread entry/exit notification callback function. */
thread_ptr -> tx_thread_entry_exit_notify = thread_entry_exit_notify;
/* Restore interrupts. */
TX_RESTORE
/* Return success to caller. */
return(TX_SUCCESS);
#endif
}
+103
View File
@@ -0,0 +1,103 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_thread.h"
#ifdef TX_ENABLE_EVENT_TRACE
#include "tx_trace.h"
#endif
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_identify PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function returns the control block pointer of the currently */
/* executing thread. If the return value is NULL, no thread is */
/* executing. */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* TX_THREAD * Pointer to control block of */
/* currently executing thread */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
TX_THREAD *_tx_thread_identify(VOID)
{
TX_THREAD *thread_ptr;
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts to put the timer on the created list. */
TX_DISABLE
#ifdef TX_ENABLE_EVENT_TRACE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_IDENTIFY, 0, 0, 0, 0, TX_TRACE_THREAD_EVENTS)
#endif
/* Log this kernel call. */
TX_EL_THREAD_IDENTIFY_INSERT
/* Pickup thread pointer. */
TX_THREAD_GET_CURRENT(thread_ptr)
/* Restore interrupts. */
TX_RESTORE
/* Return the current thread pointer. */
return(thread_ptr);
}
+163
View File
@@ -0,0 +1,163 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/
#define TX_SOURCE_CODE
/* Include necessary system files. */
#include "tx_api.h"
#include "tx_trace.h"
#include "tx_thread.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_info_get PORTABLE C */
/* 6.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function retrieves information from the specified thread. */
/* */
/* INPUT */
/* */
/* thread_ptr Pointer to thread control block */
/* name Destination for the thread name */
/* state Destination for thread state */
/* run_count Destination for thread run count */
/* priority Destination for thread priority */
/* preemption_threshold Destination for thread preemption-*/
/* threshold */
/* time_slice Destination for thread time-slice */
/* next_thread Destination for next created */
/* thread */
/* next_suspended_thread Destination for next suspended */
/* thread */
/* */
/* OUTPUT */
/* */
/* status Completion status */
/* */
/* CALLS */
/* */
/* None */
/* */
/* CALLED BY */
/* */
/* Application Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/
UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
{
TX_INTERRUPT_SAVE_AREA
/* Disable interrupts. */
TX_DISABLE
/* If trace is enabled, insert this event into the trace buffer. */
TX_TRACE_IN_LINE_INSERT(TX_TRACE_THREAD_INFO_GET, thread_ptr, thread_ptr -> tx_thread_state, 0, 0, TX_TRACE_THREAD_EVENTS)
/* Log this kernel call. */
TX_EL_THREAD_INFO_GET_INSERT
/* Retrieve all the pertinent information and return it in the supplied
destinations. */
/* Retrieve the name of the thread. */
if (name != TX_NULL)
{
*name = thread_ptr -> tx_thread_name;
}
/* Pickup the thread's current state. */
if (state != TX_NULL)
{
*state = thread_ptr -> tx_thread_state;
}
/* Pickup the number of times the thread has been scheduled. */
if (run_count != TX_NULL)
{
*run_count = thread_ptr -> tx_thread_run_count;
}
/* Pickup the thread's priority. */
if (priority != TX_NULL)
{
*priority = thread_ptr -> tx_thread_user_priority;
}
/* Pickup the thread's preemption-threshold. */
if (preemption_threshold != TX_NULL)
{
*preemption_threshold = thread_ptr -> tx_thread_user_preempt_threshold;
}
/* Pickup the thread's current time-slice. */
if (time_slice != TX_NULL)
{
*time_slice = thread_ptr -> tx_thread_time_slice;
}
/* Pickup the next created thread. */
if (next_thread != TX_NULL)
{
*next_thread = thread_ptr -> tx_thread_created_next;
}
/* Pickup the next thread suspended. */
if (next_suspended_thread != TX_NULL)
{
*next_suspended_thread = thread_ptr -> tx_thread_suspended_next;
}
/* Restore interrupts. */
TX_RESTORE
/* Return completion status. */
return(TX_SUCCESS);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More