Made ThreadX object names const-qualifiable behind an option (#761)

Fixes #61

Object names are exposed as writable pointers throughout the kernel API, which
rejects string literals in C++ and lets a caller modify a name an object still
holds. Information services return those names through writable double
pointers.

Create services, control blocks, information services, the module manager and
trace registration now preserve const qualification, behind
TX_ENABLE_CONST_NAMES. The option defaults to off, so a build that says nothing
gets exactly the types it got before. It is opt-in rather than opt-out because
it changes the type of a public struct field: application code that copies a
name into a writable CHAR * stops compiling, which is a reasonable thing to ask
of a minor release and not of a patch one. Issue #780 tracks making it the
default in 6.6.

Two things the option reaches that its own call sites do not.
TX_CHAR_TO_UCHAR_POINTER_CONVERT has exactly two users, both of them reading an
object name in _tx_trace_object_register, and every form of that macro but the
MISRA one casts the qualifier away without saying so; the conversion is now
const in and const out, so nothing launders const to make the build pass. The
FreeRTOS adapter holds the name pcTaskGetName retrieves in a TX_NAME_CONST
pointer so that it tracks whichever declaration tx_thread_info_get has, and
keeps its writable return type through an explicit MISRA C:2012 Rule 11.8 cast,
because that signature is part of the FreeRTOS API.

Default build: all seven host configurations and all five SMP configurations
build with zero warnings and pass -- 113/113 on five host configurations,
100/100 on the two MISRA builds, 118/118 on SMP, 3/3 FreeRTOS. With
TX_ENABLE_CONST_NAMES set, the host default and both MISRA configurations, the
SMP trace configuration and the FreeRTOS adapter build with zero warnings and
pass.

Co-authored-by: Tilen Majerle <tilen@majerle.eu>
Assisted-by: Codex (gpt-6-astra) <noreply@openai.com>
Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
This commit is contained in:
Frédéric Desbiens
2026-09-28 14:08:13 -04:00
committed by GitHub
co-authored by Tilen Majerle
parent 83361990cb
commit cf577c7137
135 changed files with 622 additions and 318 deletions
+10 -10
View File
@@ -37,17 +37,17 @@ static int txfr_failures;
/* The real entry points, supplied by the linker in response to --wrap. */
UINT __real__txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, ULONG wait_option);
UINT __real__txe_byte_release(VOID *memory_ptr);
UINT __real__txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
UINT __real__txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
UINT __real__txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
UINT __real__txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
UINT __real__txe_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
UINT __real__txe_mutex_delete(TX_MUTEX *mutex_ptr);
UINT __real__txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
UINT __real__txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr, UINT event_control_block_size);
UINT __real__txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
UINT __real__txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG input),
UINT __real__txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*expiration_function)(ULONG input),
ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks,
UINT auto_activate, UINT timer_control_block_size);
UINT __real__txe_timer_delete(TX_TIMER *timer_ptr);
UINT __real__txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input),
UINT __real__txe_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input),
ULONG entry_input, VOID *stack_start, ULONG stack_size, UINT priority,
UINT preempt_threshold, ULONG time_slice, UINT auto_start,
UINT thread_control_block_size);
@@ -93,7 +93,7 @@ UINT __wrap__txe_byte_release(VOID *memory_ptr)
}
UINT __wrap__txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size)
UINT __wrap__txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size)
{
if(txfr_should_fail(TXFR_INJECT_SEMAPHORE_CREATE) != 0)
{
@@ -121,7 +121,7 @@ UINT __wrap__txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr)
}
UINT __wrap__txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size)
UINT __wrap__txe_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size)
{
if(txfr_should_fail(TXFR_INJECT_MUTEX_CREATE) != 0)
{
@@ -149,7 +149,7 @@ UINT __wrap__txe_mutex_delete(TX_MUTEX *mutex_ptr)
}
UINT __wrap__txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size)
UINT __wrap__txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr, UINT event_control_block_size)
{
if(txfr_should_fail(TXFR_INJECT_EVENT_FLAGS_CREATE) != 0)
{
@@ -177,7 +177,7 @@ UINT __wrap__txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr)
}
UINT __wrap__txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG input),
UINT __wrap__txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*expiration_function)(ULONG input),
ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks,
UINT auto_activate, UINT timer_control_block_size)
{
@@ -208,7 +208,7 @@ UINT __wrap__txe_timer_delete(TX_TIMER *timer_ptr)
}
UINT __wrap__txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input),
UINT __wrap__txe_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*entry_function)(ULONG entry_input),
ULONG entry_input, VOID *stack_start, ULONG stack_size, UINT priority,
UINT preempt_threshold, ULONG time_slice, UINT auto_start,
UINT thread_control_block_size)
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple memory block pool creation, deletion, and
allocates and releases. */
@@ -72,7 +74,7 @@ void test_control_return(UINT status);
/* Prototype direct call to block pool core service. */
UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG block_size,
VOID *pool_start, ULONG pool_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test error detection for simple memory block operations. */
#include <stdio.h>
@@ -29,7 +31,7 @@ static CHAR *pointer;
static void thread_0_entry(ULONG thread_input);
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG block_size,
VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test block memory information services. */
#include <stdio.h>
@@ -68,7 +70,7 @@ static void thread_5_entry(ULONG thread_input);
static void thread_6_entry(ULONG thread_input);
/* Direct core function to bypass the error checking shell. */
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_blocks,
ULONG *total_blocks, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
@@ -227,7 +229,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
VOID *pointer;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG total_blocks;
TX_THREAD *first_suspended;
@@ -369,7 +371,7 @@ ULONG timeouts;
status += tx_block_pool_info_get(&block_pool_0, &name, &available, &total_blocks, &first_suspended, &suspended_count, &next_pool);
/* Check for an error condition. */
if ((status) || (available != block_pool_0.tx_block_pool_available) || (total_blocks != block_pool_0.tx_block_pool_total) ||
if ((status) || (name != block_pool_0.tx_block_pool_name) || (available != block_pool_0.tx_block_pool_available) || (total_blocks != block_pool_0.tx_block_pool_total) ||
(first_suspended != &thread_4) || (suspended_count != block_pool_0.tx_block_pool_suspended_count) || (next_pool != &block_pool_0))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple memory byte pool creation, deletion, and
allocates and releases. */
@@ -42,7 +44,7 @@ extern UINT test_byte_pool_create_init;
extern VOID (*test_isr_dispatch)(void);
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, VOID *pool_start,
ULONG pool_size, UINT pool_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test byte memory information. */
#include <stdio.h>
@@ -226,7 +228,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
VOID *pointer;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG fragments;
TX_THREAD *first_suspended;
@@ -369,7 +371,7 @@ ULONG timeouts;
status += tx_byte_pool_info_get(&byte_pool_0, &name, &available, &fragments, &first_suspended, &suspended_count, &next_pool);
/* Check the status. */
if ((status != TX_SUCCESS) || (available != byte_pool_0.tx_byte_pool_available) || (fragments != byte_pool_0.tx_byte_pool_fragments) ||
if ((status != TX_SUCCESS) || (name != byte_pool_0.tx_byte_pool_name) || (available != byte_pool_0.tx_byte_pool_available) || (fragments != byte_pool_0.tx_byte_pool_fragments) ||
(first_suspended != &thread_4) || (suspended_count != byte_pool_0.tx_byte_pool_suspended_count) || (next_pool != &byte_pool_0))
{
@@ -133,7 +133,7 @@ void threadx_byte_memory_long_search_application_define(void *first_unused_me
UINT status;
CHAR *pointer;
UINT i;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG fragments;
void *probe_ptr;
@@ -259,7 +259,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
UINT i;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG fragments;
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple event flag group creation, deletion, gets and
sets. */
@@ -57,7 +59,7 @@ static TX_EVENT_FLAGS_GROUP group_3;
static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr, UINT event_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the event flag group information gathering services. */
#include <stdio.h>
@@ -134,7 +136,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
ULONG actual_events;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG current_flags;
TX_THREAD *first_suspended;
ULONG suspended_count;
@@ -356,7 +358,7 @@ ULONG timeouts;
status += tx_event_flags_info_get(&group_0, &name, &current_flags, &first_suspended, &suspended_count, &next_group);
/* Check the status. */
if ((status != TX_SUCCESS) || (current_flags != group_0.tx_event_flags_group_current) || (first_suspended != TX_NULL) || (suspended_count != 0) || (next_group != &group_1))
if ((status != TX_SUCCESS) || (name != group_0.tx_event_flags_group_name) || (current_flags != group_0.tx_event_flags_group_current) || (first_suspended != TX_NULL) || (suspended_count != 0) || (next_group != &group_1))
{
/* Event flag error. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the mutex create/delete and immediate
return gets and puts. */
@@ -69,7 +71,7 @@ static void thread_2_entry(ULONG thread_input);
static void thread_3_entry(ULONG thread_input);
static void thread_4_entry(ULONG thread_input);
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the mutex information services. */
#include <stdio.h>
@@ -134,7 +136,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG count;
TX_THREAD *owner;
TX_THREAD *first_suspended;
@@ -300,7 +302,7 @@ ULONG inheritances;
status += tx_mutex_info_get(&mutex_2, &name, &count, &owner, &first_suspended, &suspended_count, &next_mutex);
/* Check status. */
if ((status != TX_SUCCESS) || (count != mutex_2.tx_mutex_ownership_count) || (owner != mutex_2.tx_mutex_owner) ||
if ((status != TX_SUCCESS) || (name != mutex_2.tx_mutex_name) || (count != mutex_2.tx_mutex_ownership_count) || (owner != mutex_2.tx_mutex_owner) ||
(first_suspended != mutex_2.tx_mutex_suspension_list) || (suspended_count != mutex_2.tx_mutex_suspended_count) || (next_mutex != mutex_2.tx_mutex_created_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test immediate response queue services including create
and delete. This test is for queue sizes of 1 ULONG. Two queues are used one with
a capacity of 1 message and another with a capacity of 3 messages. */
@@ -51,7 +53,7 @@ static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
UINT _txe_queue_create(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the queue information services. */
#include <stdio.h>
@@ -102,7 +104,7 @@ UINT status;
ULONG source_message = 0x12345678UL;
ULONG dest_message;
ULONG expected_message;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG enqueued;
ULONG available_storage;
TX_THREAD *first_suspended;
@@ -409,7 +411,7 @@ ULONG timeouts;
status += tx_queue_info_get(&queue_0, &name, &enqueued, &available_storage, &first_suspended, &suspended_count, &next_queue);
/* Check for errors. */
if ((status != TX_SUCCESS) || (enqueued != queue_0.tx_queue_enqueued) || (available_storage != queue_0.tx_queue_available_storage) ||
if ((status != TX_SUCCESS) || (name != queue_0.tx_queue_name) || (enqueued != queue_0.tx_queue_enqueued) || (available_storage != queue_0.tx_queue_available_storage) ||
(first_suspended != queue_0.tx_queue_suspension_list) || (suspended_count != queue_0.tx_queue_suspended_count) ||
(next_queue != queue_0.tx_queue_created_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the semaphore create/delete and immediate return gets and puts. */
#include <stdio.h>
@@ -62,7 +64,7 @@ static TX_SEMAPHORE semaphore_3;
static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the semaphore information services. */
#include <stdio.h>
@@ -100,7 +102,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG current_value;
TX_THREAD *first_suspended;
ULONG suspended_count;
@@ -211,7 +213,7 @@ ULONG timeouts;
status += tx_semaphore_info_get(&semaphore_0, &name, &current_value, &first_suspended, &suspended_count, &next_semaphore);
/* Check status. */
if ((status != TX_SUCCESS) || (current_value != semaphore_0.tx_semaphore_count) ||
if ((status != TX_SUCCESS) || (name != semaphore_0.tx_semaphore_name) || (current_value != semaphore_0.tx_semaphore_count) ||
(first_suspended != semaphore_0.tx_semaphore_suspension_list) || (suspended_count != semaphore_0.tx_semaphore_suspended_count) ||
(next_semaphore != semaphore_0.tx_semaphore_created_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to see if one thread can be created and executed.
It thread_0_entry is hit, then the thread was successfully scheduled.
On success, thread_0_counter gets incremented. */
@@ -69,7 +71,7 @@ static unsigned long isr_executed = 0;
static void thread_0_entry(ULONG task_input);
UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
UINT _txe_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG), ULONG entry_input,
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is for the thread information services. */
#include <stdio.h>
@@ -63,7 +65,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
UINT state;
ULONG run_count;
UINT priority;
@@ -96,7 +98,7 @@ ULONG idle_returns;
status += tx_thread_info_get(&thread_0, &name, &state, &run_count, &priority, &preemption_threshold, &time_slice, &next_thread, &suspended_thread);
/* Check for error status. */
if ((status != TX_SUCCESS) || (state != TX_READY) || (run_count != thread_0.tx_thread_run_count) || (priority != 16) || (preemption_threshold != 16) ||
if ((status != TX_SUCCESS) || (name != thread_0.tx_thread_name) || (state != TX_READY) || (run_count != thread_0.tx_thread_run_count) || (priority != 16) || (preemption_threshold != 16) ||
(time_slice != 0) || (next_thread != thread_0.tx_thread_created_next) || (suspended_thread != thread_0.tx_thread_suspended_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test timer information services. */
#include <stdio.h>
@@ -104,7 +106,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
UINT interrupt_status;
CHAR *name;
TX_NAME_CONST CHAR *name;
UINT active;
ULONG remaining_ticks;
ULONG reschedule_ticks;
@@ -231,7 +233,7 @@ TX_TIMER_INTERNAL **list_head;
status += tx_timer_info_get(&timer_0, &name, &active, &remaining_ticks, &reschedule_ticks, &next_timer);
/* Check for successful completion. */
if ((status != TX_SUCCESS) || (active != TX_TRUE) || (remaining_ticks != 100) || (reschedule_ticks != 200) || (next_timer != &timer_1))
if ((status != TX_SUCCESS) || (name != timer_0.tx_timer_name) || (active != TX_TRUE) || (remaining_ticks != 100) || (reschedule_ticks != 200) || (next_timer != &timer_1))
{
/* Application timer error. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test a simple application timer services, including create,
activate, deactivate, change, and delete. */
@@ -63,7 +65,7 @@ static void thread_1_entry(ULONG thread_input);
static void timer_0_expiration(ULONG timer_input);
static void timer_1_expiration(ULONG timer_input);
UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
UINT _txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(ULONG), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test trace functionality in ThreadX. */
#include <stdio.h>
@@ -30,7 +32,7 @@
extern VOID (*test_isr_dispatch)(void);
extern UINT _tx_trace_interrupt_control(UINT new_posture);
extern VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
extern VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, TX_NAME_CONST CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
extern VOID _tx_trace_object_unregister(VOID *object_ptr);
static unsigned long thread_0_counter = 0;
@@ -414,7 +414,7 @@ static UINT test_service_record(ALIGN_TYPE object_ptr, ALIGN_TYPE name_ptr, ULO
}
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG block_size,
VOID *pool_start, ULONG pool_size, UINT pool_control_block_size)
{
@@ -446,7 +446,7 @@ UINT status;
}
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, VOID *pool_start,
ULONG pool_size, UINT pool_control_block_size)
{
@@ -478,7 +478,7 @@ UINT status;
}
UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
UINT _txe_queue_create(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size, UINT queue_control_block_size)
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple memory block pool creation, deletion, and
allocates and releases. */
@@ -72,7 +74,7 @@ void test_control_return(UINT status);
/* Prototype direct call to block pool core service. */
UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG block_size,
VOID *pool_start, ULONG pool_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test error detection for simple memory block operations. */
#include <stdio.h>
@@ -29,7 +31,7 @@ static CHAR *pointer;
static void thread_0_entry(ULONG thread_input);
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG block_size,
VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test block memory information services. */
#include <stdio.h>
@@ -68,7 +70,7 @@ static void thread_5_entry(ULONG thread_input);
static void thread_6_entry(ULONG thread_input);
/* Direct core function to bypass the error checking shell. */
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_blocks,
ULONG *total_blocks, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
@@ -227,7 +229,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
VOID *pointer;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG total_blocks;
TX_THREAD *first_suspended;
@@ -369,7 +371,7 @@ ULONG timeouts;
status += tx_block_pool_info_get(&block_pool_0, &name, &available, &total_blocks, &first_suspended, &suspended_count, &next_pool);
/* Check for an error condition. */
if ((status) || (available != block_pool_0.tx_block_pool_available) || (total_blocks != block_pool_0.tx_block_pool_total) ||
if ((status) || (name != block_pool_0.tx_block_pool_name) || (available != block_pool_0.tx_block_pool_available) || (total_blocks != block_pool_0.tx_block_pool_total) ||
(first_suspended != &thread_4) || (suspended_count != block_pool_0.tx_block_pool_suspended_count) || (next_pool != &block_pool_0))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple memory byte pool creation, deletion, and
allocates and releases. */
@@ -51,7 +53,7 @@ extern UINT test_byte_pool_create_init;
extern VOID (*test_isr_dispatch)(void);
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, VOID *pool_start,
ULONG pool_size, UINT pool_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test byte memory information. */
#include <stdio.h>
@@ -226,7 +228,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
VOID *pointer;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG available;
ULONG fragments;
TX_THREAD *first_suspended;
@@ -369,7 +371,7 @@ ULONG timeouts;
status += tx_byte_pool_info_get(&byte_pool_0, &name, &available, &fragments, &first_suspended, &suspended_count, &next_pool);
/* Check the status. */
if ((status != TX_SUCCESS) || (available != byte_pool_0.tx_byte_pool_available) || (fragments != byte_pool_0.tx_byte_pool_fragments) ||
if ((status != TX_SUCCESS) || (name != byte_pool_0.tx_byte_pool_name) || (available != byte_pool_0.tx_byte_pool_available) || (fragments != byte_pool_0.tx_byte_pool_fragments) ||
(first_suspended != &thread_4) || (suspended_count != byte_pool_0.tx_byte_pool_suspended_count) || (next_pool != &byte_pool_0))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test simple event flag group creation, deletion, gets and
sets. */
@@ -57,7 +59,7 @@ static TX_EVENT_FLAGS_GROUP group_3;
static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr, UINT event_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the event flag group information gathering services. */
#include <stdio.h>
@@ -134,7 +136,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
ULONG actual_events;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG current_flags;
TX_THREAD *first_suspended;
ULONG suspended_count;
@@ -356,7 +358,7 @@ ULONG timeouts;
status += tx_event_flags_info_get(&group_0, &name, &current_flags, &first_suspended, &suspended_count, &next_group);
/* Check the status. */
if ((status != TX_SUCCESS) || (current_flags != group_0.tx_event_flags_group_current) || (first_suspended != TX_NULL) || (suspended_count != 0) || (next_group != &group_1))
if ((status != TX_SUCCESS) || (name != group_0.tx_event_flags_group_name) || (current_flags != group_0.tx_event_flags_group_current) || (first_suspended != TX_NULL) || (suspended_count != 0) || (next_group != &group_1))
{
/* Event flag error. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the mutex create/delete and immediate
return gets and puts. */
@@ -69,7 +71,7 @@ static void thread_2_entry(ULONG thread_input);
static void thread_3_entry(ULONG thread_input);
static void thread_4_entry(ULONG thread_input);
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the mutex information services. */
#include <stdio.h>
@@ -134,7 +136,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG count;
TX_THREAD *owner;
TX_THREAD *first_suspended;
@@ -300,7 +302,7 @@ ULONG inheritances;
status += tx_mutex_info_get(&mutex_2, &name, &count, &owner, &first_suspended, &suspended_count, &next_mutex);
/* Check status. */
if ((status != TX_SUCCESS) || (count != mutex_2.tx_mutex_ownership_count) || (owner != mutex_2.tx_mutex_owner) ||
if ((status != TX_SUCCESS) || (name != mutex_2.tx_mutex_name) || (count != mutex_2.tx_mutex_ownership_count) || (owner != mutex_2.tx_mutex_owner) ||
(first_suspended != mutex_2.tx_mutex_suspension_list) || (suspended_count != mutex_2.tx_mutex_suspended_count) || (next_mutex != mutex_2.tx_mutex_created_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test immediate response queue services including create
and delete. This test is for queue sizes of 1 ULONG. Two queues are used one with
a capacity of 1 message and another with a capacity of 3 messages. */
@@ -51,7 +53,7 @@ static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
UINT _txe_queue_create(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the queue information services. */
#include <stdio.h>
@@ -102,7 +104,7 @@ UINT status;
ULONG source_message = 0x12345678UL;
ULONG dest_message;
ULONG expected_message;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG enqueued;
ULONG available_storage;
TX_THREAD *first_suspended;
@@ -409,7 +411,7 @@ ULONG timeouts;
status += tx_queue_info_get(&queue_0, &name, &enqueued, &available_storage, &first_suspended, &suspended_count, &next_queue);
/* Check for errors. */
if ((status != TX_SUCCESS) || (enqueued != queue_0.tx_queue_enqueued) || (available_storage != queue_0.tx_queue_available_storage) ||
if ((status != TX_SUCCESS) || (name != queue_0.tx_queue_name) || (enqueued != queue_0.tx_queue_enqueued) || (available_storage != queue_0.tx_queue_available_storage) ||
(first_suspended != queue_0.tx_queue_suspension_list) || (suspended_count != queue_0.tx_queue_suspended_count) ||
(next_queue != queue_0.tx_queue_created_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the semaphore create/delete and immediate return gets and puts. */
#include <stdio.h>
@@ -62,7 +64,7 @@ static TX_SEMAPHORE semaphore_3;
static void thread_0_entry(ULONG thread_input);
static void thread_1_entry(ULONG thread_input);
UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
/* Prototype for test control return. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test the semaphore information services. */
#include <stdio.h>
@@ -100,7 +102,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
ULONG current_value;
TX_THREAD *first_suspended;
ULONG suspended_count;
@@ -211,7 +213,7 @@ ULONG timeouts;
status += tx_semaphore_info_get(&semaphore_0, &name, &current_value, &first_suspended, &suspended_count, &next_semaphore);
/* Check status. */
if ((status != TX_SUCCESS) || (current_value != semaphore_0.tx_semaphore_count) ||
if ((status != TX_SUCCESS) || (name != semaphore_0.tx_semaphore_name) || (current_value != semaphore_0.tx_semaphore_count) ||
(first_suspended != semaphore_0.tx_semaphore_suspension_list) || (suspended_count != semaphore_0.tx_semaphore_suspended_count) ||
(next_semaphore != semaphore_0.tx_semaphore_created_next))
{
@@ -73,7 +73,7 @@ extern TX_TIMER_INTERNAL *_tx_timer_expired_timer_ptr;
static void thread_0_entry(ULONG task_input);
UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
UINT _txe_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG), ULONG entry_input,
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is for the thread information services. */
#include <stdio.h>
@@ -63,7 +65,7 @@ static void thread_0_entry(ULONG thread_input)
{
UINT status;
CHAR *name;
TX_NAME_CONST CHAR *name;
UINT state;
ULONG run_count;
UINT priority;
@@ -96,7 +98,7 @@ ULONG idle_returns;
status += tx_thread_info_get(&thread_0, &name, &state, &run_count, &priority, &preemption_threshold, &time_slice, &next_thread, &suspended_thread);
/* Check for error status. */
if ((status != TX_SUCCESS) || (state != TX_READY) || (run_count != thread_0.tx_thread_run_count) || (priority != 16) || (preemption_threshold != 16) ||
if ((status != TX_SUCCESS) || (name != thread_0.tx_thread_name) || (state != TX_READY) || (run_count != thread_0.tx_thread_run_count) || (priority != 16) || (preemption_threshold != 16) ||
(time_slice != 0) || (next_thread != thread_0.tx_thread_created_next) || (suspended_thread != thread_0.tx_thread_suspended_next))
{
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test timer information services. */
#include <stdio.h>
@@ -104,7 +106,7 @@ static void thread_0_entry(ULONG thread_input)
UINT status;
UINT interrupt_status;
CHAR *name;
TX_NAME_CONST CHAR *name;
UINT active;
ULONG remaining_ticks;
ULONG reschedule_ticks;
@@ -231,7 +233,7 @@ TX_TIMER_INTERNAL **list_head;
status += tx_timer_info_get(&timer_0, &name, &active, &remaining_ticks, &reschedule_ticks, &next_timer);
/* Check for successful completion. */
if ((status != TX_SUCCESS) || (active != TX_TRUE) || (remaining_ticks != 100) || (reschedule_ticks != 200) || (next_timer != &timer_1))
if ((status != TX_SUCCESS) || (name != timer_0.tx_timer_name) || (active != TX_TRUE) || (remaining_ticks != 100) || (reschedule_ticks != 200) || (next_timer != &timer_1))
{
/* Application timer error. */
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
/* Portions of this file were generated with AI assistance. */
/* This test is designed to test a simple application timer services, including create,
activate, deactivate, change, and delete. */
@@ -63,7 +65,7 @@ static void thread_1_entry(ULONG thread_input);
static void timer_0_expiration(ULONG timer_input);
static void timer_1_expiration(ULONG timer_input);
UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
UINT _txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(ULONG), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
@@ -25,7 +25,7 @@
extern VOID (*test_isr_dispatch)(void);
extern UINT _tx_trace_interrupt_control(UINT new_posture);
extern VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
extern VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, TX_NAME_CONST CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
extern VOID _tx_trace_object_unregister(VOID *object_ptr);
static unsigned long thread_0_counter = 0;