summaryrefslogtreecommitdiff
path: root/common_smp
diff options
context:
space:
mode:
Diffstat (limited to 'common_smp')
-rw-r--r--common_smp/inc/tx_api.h114
-rw-r--r--common_smp/inc/tx_thread.h11
-rw-r--r--common_smp/inc/tx_trace.h6
-rw-r--r--common_smp/inc/tx_user_sample.h9
-rw-r--r--common_smp/src/tx_block_pool_create.c4
-rw-r--r--common_smp/src/tx_block_pool_info_get.c4
-rw-r--r--common_smp/src/tx_byte_pool_create.c4
-rw-r--r--common_smp/src/tx_byte_pool_info_get.c4
-rw-r--r--common_smp/src/tx_event_flags_create.c4
-rw-r--r--common_smp/src/tx_event_flags_info_get.c4
-rw-r--r--common_smp/src/tx_misra.c30
-rw-r--r--common_smp/src/tx_mutex_create.c4
-rw-r--r--common_smp/src/tx_mutex_info_get.c4
-rw-r--r--common_smp/src/tx_queue_create.c4
-rw-r--r--common_smp/src/tx_queue_info_get.c4
-rw-r--r--common_smp/src/tx_semaphore_create.c4
-rw-r--r--common_smp/src/tx_semaphore_info_get.c4
-rw-r--r--common_smp/src/tx_thread_create.c34
-rw-r--r--common_smp/src/tx_thread_delete.c27
-rw-r--r--common_smp/src/tx_thread_info_get.c4
-rw-r--r--common_smp/src/tx_thread_relinquish.c8
-rw-r--r--common_smp/src/tx_thread_reset.c24
-rw-r--r--common_smp/src/tx_thread_shell_entry.c22
-rw-r--r--common_smp/src/tx_thread_sleep.c4
-rw-r--r--common_smp/src/tx_thread_smp_utilities.c9
-rw-r--r--common_smp/src/tx_thread_stack_analyze.c63
-rw-r--r--common_smp/src/tx_thread_terminate.c47
-rw-r--r--common_smp/src/tx_timer_create.c4
-rw-r--r--common_smp/src/tx_timer_info_get.c4
-rw-r--r--common_smp/src/tx_trace_object_register.c19
-rw-r--r--common_smp/src/txe_block_pool_create.c4
-rw-r--r--common_smp/src/txe_block_pool_info_get.c4
-rw-r--r--common_smp/src/txe_byte_pool_create.c4
-rw-r--r--common_smp/src/txe_byte_pool_info_get.c4
-rw-r--r--common_smp/src/txe_event_flags_create.c4
-rw-r--r--common_smp/src/txe_event_flags_info_get.c4
-rw-r--r--common_smp/src/txe_mutex_create.c4
-rw-r--r--common_smp/src/txe_mutex_info_get.c4
-rw-r--r--common_smp/src/txe_queue_create.c4
-rw-r--r--common_smp/src/txe_queue_info_get.c4
-rw-r--r--common_smp/src/txe_semaphore_create.c4
-rw-r--r--common_smp/src/txe_semaphore_info_get.c4
-rw-r--r--common_smp/src/txe_thread_create.c4
-rw-r--r--common_smp/src/txe_thread_info_get.c4
-rw-r--r--common_smp/src/txe_timer_change.c12
-rw-r--r--common_smp/src/txe_timer_create.c4
-rw-r--r--common_smp/src/txe_timer_info_get.c4
47 files changed, 431 insertions, 132 deletions
diff --git a/common_smp/inc/tx_api.h b/common_smp/inc/tx_api.h
index 7d0ccbe5..77bd6218 100644
--- a/common_smp/inc/tx_api.h
+++ b/common_smp/inc/tx_api.h
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -64,6 +66,17 @@ extern "C" {
#include "tx_port.h"
+/* Define the qualifier applied to object name strings. Opting in makes every
+ object name a pointer to const, which the kernel and its tests are written
+ for. It is off by default because it changes the type of a public struct
+ field, and application code that copies a name into a writable pointer stops
+ compiling. */
+#ifdef TX_ENABLE_CONST_NAMES
+#define TX_NAME_CONST const
+#else
+#define TX_NAME_CONST
+#endif
+
/* If not defined by tx_port.h, default the port-specific memory synchronization macro to whitespace. */
@@ -392,7 +405,7 @@ typedef struct TX_TIMER_STRUCT
ULONG tx_timer_id;
/* Define the timer's name. */
- CHAR *tx_timer_name;
+ TX_NAME_CONST CHAR *tx_timer_name;
/* Define the actual contents of the timer. This is the block that
is used in the actual timer expiration processing. */
@@ -466,7 +479,7 @@ typedef struct TX_THREAD_STRUCT
is typically defined to whitespace or a pointer type in tx_port.h. */
TX_THREAD_EXTENSION_0
- CHAR *tx_thread_name; /* Pointer to thread's name */
+ TX_NAME_CONST CHAR *tx_thread_name; /* Pointer to thread's name */
UINT tx_thread_priority; /* Priority of thread (0-1023) */
UINT tx_thread_state; /* Thread's execution state */
UINT tx_thread_delayed_suspend; /* Delayed suspend flag */
@@ -632,7 +645,7 @@ typedef struct TX_BLOCK_POOL_STRUCT
ULONG tx_block_pool_id;
/* Define the block pool's name. */
- CHAR *tx_block_pool_name;
+ TX_NAME_CONST CHAR *tx_block_pool_name;
/* Define the number of available memory blocks in the pool. */
UINT tx_block_pool_available;
@@ -710,7 +723,7 @@ typedef struct TX_BYTE_POOL_STRUCT
ULONG tx_byte_pool_id;
/* Define the byte pool's name. */
- CHAR *tx_byte_pool_name;
+ TX_NAME_CONST CHAR *tx_byte_pool_name;
/* Define the number of available bytes in the pool. */
ULONG tx_byte_pool_available;
@@ -789,7 +802,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
ULONG tx_event_flags_group_id;
/* Define the event flags group's name. */
- CHAR *tx_event_flags_group_name;
+ TX_NAME_CONST CHAR *tx_event_flags_group_name;
/* Define the actual current event flags in this group. A zero in a
particular bit indicates the event flag is not set. */
@@ -875,7 +888,7 @@ typedef struct TX_MUTEX_STRUCT
ULONG tx_mutex_id;
/* Define the mutex's name. */
- CHAR *tx_mutex_name;
+ TX_NAME_CONST CHAR *tx_mutex_name;
/* Define the mutex ownership count. */
UINT tx_mutex_ownership_count;
@@ -948,7 +961,7 @@ typedef struct TX_QUEUE_STRUCT
ULONG tx_queue_id;
/* Define the queue's name. */
- CHAR *tx_queue_name;
+ TX_NAME_CONST CHAR *tx_queue_name;
/* Define the message size that was specified in queue creation. */
UINT tx_queue_message_size;
@@ -1027,7 +1040,7 @@ typedef struct TX_SEMAPHORE_STRUCT
ULONG tx_semaphore_id;
/* Define the semaphore's name. */
- CHAR *tx_semaphore_name;
+ TX_NAME_CONST CHAR *tx_semaphore_name;
/* Define the actual semaphore count. A zero means that no semaphore
instance is available. */
@@ -1530,10 +1543,10 @@ VOID tx_application_define(VOID *first_unused_memory);
/* Define block memory pool management function prototypes. */
UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
-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);
UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
-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);
UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
@@ -1548,10 +1561,10 @@ UINT _tx_block_release(VOID *block_ptr);
application. */
UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
-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);
UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
-UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
+UINT _txe_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);
UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
@@ -1562,10 +1575,10 @@ UINT _txe_block_release(VOID *block_ptr);
UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
ULONG wait_option);
-UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
+UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, VOID *pool_start,
ULONG pool_size);
UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
-UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
+UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_bytes,
ULONG *fragments, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BYTE_POOL **next_pool);
UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
@@ -1581,10 +1594,10 @@ UINT _tx_byte_release(VOID *memory_ptr);
UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
ULONG wait_option);
-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);
UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
-UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
+UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_bytes,
ULONG *fragments, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BYTE_POOL **next_pool);
UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
@@ -1593,11 +1606,11 @@ UINT _txe_byte_release(VOID *memory_ptr);
/* Define event flags management function prototypes. */
-UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr);
+UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr);
UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
-UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
+UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR **name, ULONG *current_flags,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_EVENT_FLAGS_GROUP **next_group);
UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets,
@@ -1612,11 +1625,11 @@ UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*e
/* Define error checking shells for API services. These are only referenced by the
application. */
-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);
UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
-UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
+UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR **name, ULONG *current_flags,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_EVENT_FLAGS_GROUP **next_group);
UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
@@ -1631,10 +1644,10 @@ VOID _tx_initialize_kernel_enter(VOID);
/* Define mutex management function prototypes. */
-UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit);
+UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit);
UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr);
UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
-UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
+UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR **name, ULONG *count, TX_THREAD **owner,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_MUTEX **next_mutex);
UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets,
@@ -1648,10 +1661,10 @@ UINT _tx_mutex_put(TX_MUTEX *mutex_ptr);
/* Define error checking shells for API services. These are only referenced by the
application. */
-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);
UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr);
UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
-UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
+UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR **name, ULONG *count, TX_THREAD **owner,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_MUTEX **next_mutex);
UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr);
@@ -1660,11 +1673,11 @@ UINT _txe_mutex_put(TX_MUTEX *mutex_ptr);
/* Define queue management function prototypes. */
-UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
+UINT _tx_queue_create(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size);
UINT _tx_queue_delete(TX_QUEUE *queue_ptr);
UINT _tx_queue_flush(TX_QUEUE *queue_ptr);
-UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
+UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR **name, ULONG *enqueued, ULONG *available_storage,
TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue);
UINT _tx_queue_performance_info_get(TX_QUEUE *queue_ptr, ULONG *messages_sent, ULONG *messages_received,
ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts);
@@ -1680,11 +1693,11 @@ UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wa
/* Define error checking shells for API services. These are only referenced by the
application. */
-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);
UINT _txe_queue_delete(TX_QUEUE *queue_ptr);
UINT _txe_queue_flush(TX_QUEUE *queue_ptr);
-UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
+UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR **name, ULONG *enqueued, ULONG *available_storage,
TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue);
UINT _txe_queue_prioritize(TX_QUEUE *queue_ptr);
UINT _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option);
@@ -1696,10 +1709,10 @@ UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG w
/* Define semaphore management function prototypes. */
UINT _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
-UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count);
+UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count);
UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
-UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
+UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR **name, ULONG *current_value,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_SEMAPHORE **next_semaphore);
UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets,
@@ -1714,10 +1727,10 @@ UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semapho
application. */
UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
-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);
UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
-UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
+UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR **name, ULONG *current_value,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_SEMAPHORE **next_semaphore);
UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
@@ -1729,7 +1742,7 @@ UINT _txe_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaph
VOID _tx_thread_context_save(VOID);
VOID _tx_thread_context_restore(VOID);
-UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
+UINT _tx_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,
@@ -1737,7 +1750,7 @@ UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
UINT _tx_thread_delete(TX_THREAD *thread_ptr);
UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
TX_THREAD *_tx_thread_identify(VOID);
-UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
+UINT _tx_thread_info_get(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR **name, UINT *state, ULONG *run_count,
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
UINT _tx_thread_interrupt_control(UINT new_posture);
@@ -1766,14 +1779,14 @@ UINT _tx_thread_wait_abort(TX_THREAD *thread_ptr);
/* Define error checking shells for API services. These are only referenced by the
application. */
-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 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);
UINT _txe_thread_delete(TX_THREAD *thread_ptr);
UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
-UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
+UINT _txe_thread_info_get(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR **name, UINT *state, ULONG *run_count,
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
@@ -1793,12 +1806,12 @@ UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr);
UINT _tx_timer_activate(TX_TIMER *timer_ptr);
UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
-UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
+UINT _tx_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 _tx_timer_deactivate(TX_TIMER *timer_ptr);
UINT _tx_timer_delete(TX_TIMER *timer_ptr);
-UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
+UINT _tx_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
ULONG *reschedule_ticks, TX_TIMER **next_timer);
UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates,
ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts);
@@ -1814,12 +1827,12 @@ VOID _tx_time_set(ULONG new_time);
UINT _txe_timer_activate(TX_TIMER *timer_ptr);
UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
-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 input), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
UINT _txe_timer_deactivate(TX_TIMER *timer_ptr);
UINT _txe_timer_delete(TX_TIMER *timer_ptr);
-UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
+UINT _txe_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
ULONG *reschedule_ticks, TX_TIMER **next_timer);
@@ -1853,6 +1866,19 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
#endif
+/* Define the number of consecutive stack fill pattern words the thread stack analyze function must
+ observe, working towards the lowest address of the stack, before it accepts a probe location as
+ unused. A value of one restores the original behavior, where a single word that happens to still
+ hold the fill pattern - an unwritten hole inside an otherwise used region, such as the padding of
+ a partially initialized local array - can make the binary search stop early and under-report the
+ stack usage. Larger values make the result more accurate at the cost of a few additional reads
+ per binary search iteration. This can be re-defined in tx_port.h. */
+
+#ifndef TX_THREAD_STACK_ANALYZE_FILL_WORDS
+#define TX_THREAD_STACK_ANALYZE_FILL_WORDS ((ULONG) 8)
+#endif
+
+
/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function.
By default, this is simply defined as whitespace. */
@@ -1920,7 +1946,8 @@ TX_THREAD *_tx_misra_ulong_to_thread_pointer_convert(ULONG value);
VOID *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **pointer);
CHAR *_tx_misra_const_char_to_char_pointer_convert(const char *pointer);
TX_THREAD *_tx_misra_void_to_thread_pointer_convert(VOID *pointer);
-UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer);
+const UCHAR *_tx_misra_char_to_uchar_pointer_convert(TX_NAME_CONST CHAR *pointer);
+const UCHAR *_tx_misra_const_uchar_pointer_add(const UCHAR *pointer, ULONG amount);
VOID _tx_misra_event_flags_group_not_used(TX_EVENT_FLAGS_GROUP *group_ptr);
VOID _tx_misra_event_flags_set_notify_not_used(VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
VOID _tx_misra_queue_not_used(TX_QUEUE *queue_ptr);
@@ -1932,6 +1959,7 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
#define TX_MEMSET(a,b,c) _tx_misra_memset((a), (UINT) (b), (UINT) (c))
#define TX_UCHAR_POINTER_ADD(a,b) _tx_misra_uchar_pointer_add((UCHAR *) (a), (ULONG) (b))
+#define TX_CONST_UCHAR_POINTER_ADD(a,b) _tx_misra_const_uchar_pointer_add((const UCHAR *) (a), (ULONG) (b))
#define TX_UCHAR_POINTER_SUB(a,b) _tx_misra_uchar_pointer_sub((UCHAR *) (a), (ULONG) (b))
#define TX_UCHAR_POINTER_DIF(a,b) _tx_misra_uchar_pointer_dif((UCHAR *) (a), (UCHAR *) (b))
#define TX_ULONG_POINTER_ADD(a,b) _tx_misra_ulong_pointer_add((ULONG *) (a), (ULONG) (b))
@@ -1992,6 +2020,7 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
#endif
#define TX_UCHAR_POINTER_ADD(a,b) (((UCHAR *) (a)) + ((UINT) (b)))
+#define TX_CONST_UCHAR_POINTER_ADD(a,b) (((const UCHAR *) (a)) + ((UINT) (b)))
#define TX_UCHAR_POINTER_SUB(a,b) (((UCHAR *) (a)) - ((UINT) (b)))
#define TX_UCHAR_POINTER_DIF(a,b) ((ULONG)(((UCHAR *) (a)) - ((UCHAR *) (b))))
#define TX_ULONG_POINTER_ADD(a,b) (((ULONG *) (a)) + ((UINT) (b)))
@@ -2039,7 +2068,7 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
#endif
#define TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT(a) ((CHAR *) ((VOID *) (a)))
#define TX_VOID_TO_THREAD_POINTER_CONVERT(a) ((TX_THREAD *) ((VOID *) (a)))
-#define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a)))
+#define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a) ((const UCHAR *) ((const VOID *) (a)))
#ifndef TX_EVENT_FLAGS_GROUP_NOT_USED
#define TX_EVENT_FLAGS_GROUP_NOT_USED(a) ((void)(a))
#endif
@@ -2330,4 +2359,3 @@ void __ghs_rnerr(char *errMsg, int stackLevels, int stackTraceDisplay, void *hex
#endif
#endif
-
diff --git a/common_smp/inc/tx_thread.h b/common_smp/inc/tx_thread.h
index 7dc7801b..1ffe8828 100644
--- a/common_smp/inc/tx_thread.h
+++ b/common_smp/inc/tx_thread.h
@@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
/**************************************************************************/
/**************************************************************************/
@@ -82,7 +83,7 @@
_tx_thread_stack_error_handler((thread_ptr)); \
TX_DISABLE \
} \
- if (*(((ULONG *) (thread_ptr) -> tx_thread_stack_highest_ptr) - 1) != TX_STACK_FILL) \
+ else if (*(((ULONG *) (thread_ptr) -> tx_thread_stack_highest_ptr) - 1) != TX_STACK_FILL) \
{ \
TX_RESTORE \
_tx_thread_stack_analyze((thread_ptr)); \
@@ -1171,6 +1172,11 @@ TX_THREAD *last_thread;
TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
+ /* Limit the supplied core maps to the cores that are actually present. */
+ available_cores = available_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+ thread_possible_cores = thread_possible_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+ test_possible_cores = test_possible_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+
/* Clear the last thread cores in the search. */
last_thread_cores = ((ULONG) 0);
@@ -1181,6 +1187,9 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
queue_first = ((UINT) 0);
queue_last = ((UINT) 0);
+ /* Initialize the first core queue entry. */
+ core_queue[0] = ((UINT) 0);
+
/* Build a list of possible cores for this thread to execute on, starting
with the previously mapped core. */
core = schedule_thread -> tx_thread_smp_core_mapped;
diff --git a/common_smp/inc/tx_trace.h b/common_smp/inc/tx_trace.h
index ea0e59e5..2f4447d4 100644
--- a/common_smp/inc/tx_trace.h
+++ b/common_smp/inc/tx_trace.h
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -452,7 +454,7 @@ TRACE_DECLARE ULONG _tx_trace_registry_search_start
#define TX_TRACE_INITIALIZE _tx_trace_initialize();
-#define TX_TRACE_OBJECT_REGISTER(t,p,n,a,b) _tx_trace_object_register((UCHAR) (t), (VOID *) (p), (CHAR *) (n), (ULONG) (a), (ULONG) (b));
+#define TX_TRACE_OBJECT_REGISTER(t,p,n,a,b) _tx_trace_object_register((UCHAR) (t), (VOID *) (p), (n), (ULONG) (a), (ULONG) (b));
#define TX_TRACE_OBJECT_UNREGISTER(o) _tx_trace_object_unregister((VOID *) (o));
#ifndef TX_TRACE_IN_LINE_INSERT
#define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,e) \
@@ -515,7 +517,7 @@ TRACE_DECLARE ULONG _tx_trace_registry_search_start
/* Define internal function prototypes of the trace component, only if compiling ThreadX source code. */
VOID _tx_trace_initialize(VOID);
-VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
+VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, TX_NAME_CONST CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
VOID _tx_trace_object_unregister(VOID *object_ptr);
diff --git a/common_smp/inc/tx_user_sample.h b/common_smp/inc/tx_user_sample.h
index 64ff9aed..1514a0db 100644
--- a/common_smp/inc/tx_user_sample.h
+++ b/common_smp/inc/tx_user_sample.h
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -100,6 +102,12 @@
#define TX_TIMER_TICKS_PER_SECOND (100UL)
*/
+/* Define this option to qualify object names as pointers to const. */
+
+/*
+#define TX_ENABLE_CONST_NAMES
+*/
+
/* Determine if there is a FileX pointer in the thread control block.
By default, the pointer is there for legacy/backwards compatibility.
The pointer must also be there for applications using FileX.
@@ -288,4 +296,3 @@
*/
#endif
-
diff --git a/common_smp/src/tx_block_pool_create.c b/common_smp/src/tx_block_pool_create.c
index 1d2c803c..8781dc78 100644
--- a/common_smp/src/tx_block_pool_create.c
+++ b/common_smp/src/tx_block_pool_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -66,7 +68,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
diff --git a/common_smp/src/tx_block_pool_info_get.c b/common_smp/src/tx_block_pool_info_get.c
index 5998f1db..5e1e89fd 100644
--- a/common_smp/src/tx_block_pool_info_get.c
+++ b/common_smp/src/tx_block_pool_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -69,7 +71,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
diff --git a/common_smp/src/tx_byte_pool_create.c b/common_smp/src/tx_byte_pool_create.c
index 21abbe35..f5c8460d 100644
--- a/common_smp/src/tx_byte_pool_create.c
+++ b/common_smp/src/tx_byte_pool_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -65,7 +67,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size)
+UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR *name_ptr, VOID *pool_start, ULONG pool_size)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/tx_byte_pool_info_get.c b/common_smp/src/tx_byte_pool_info_get.c
index bd096440..e9e9efa4 100644
--- a/common_smp/src/tx_byte_pool_info_get.c
+++ b/common_smp/src/tx_byte_pool_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -69,7 +71,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
+UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_bytes,
ULONG *fragments, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BYTE_POOL **next_pool)
{
diff --git a/common_smp/src/tx_event_flags_create.c b/common_smp/src/tx_event_flags_create.c
index 2a9c042d..361fafa4 100644
--- a/common_smp/src/tx_event_flags_create.c
+++ b/common_smp/src/tx_event_flags_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -64,7 +66,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr)
+UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR *name_ptr)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/tx_event_flags_info_get.c b/common_smp/src/tx_event_flags_info_get.c
index 21e85c9a..51ec345f 100644
--- a/common_smp/src/tx_event_flags_info_get.c
+++ b/common_smp/src/tx_event_flags_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -71,7 +73,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
+UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR **name, ULONG *current_flags,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_EVENT_FLAGS_GROUP **next_group)
{
diff --git a/common_smp/src/tx_misra.c b/common_smp/src/tx_misra.c
index f5dd5f53..b9144a70 100644
--- a/common_smp/src/tx_misra.c
+++ b/common_smp/src/tx_misra.c
@@ -47,7 +47,7 @@
/**************************************************************************/
VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size)
{
- memset(ptr, value, size);
+ memset(ptr, (INT)value, size);
}
@@ -91,7 +91,7 @@ ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2)
ULONG value;
- value = ptr1 - ptr2;
+ value = (ULONG)(ptr1 - ptr2);
return(value);
}
@@ -149,7 +149,7 @@ ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2)
{
ULONG value;
- value = ptr1 - ptr2;
+ value = (ULONG)(ptr1 - ptr2);
return(value);
}
@@ -219,7 +219,7 @@ ULONG _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, TX_TIMER_INTERNAL *
ULONG value;
- value = ptr1 - ptr2;
+ value = (ULONG)(ptr1 - ptr2);
return(value);
}
@@ -625,6 +625,8 @@ TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer)
UINT _tx_misra_status_get(UINT status)
{
+ (VOID)status;
+
/* Return a successful status. */
return(TX_SUCCESS);
}
@@ -817,15 +819,29 @@ UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer)
/***********************************************************************************************/
/***********************************************************************************************/
/** */
-/** UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer); */
+/** const UCHAR *_tx_misra_char_to_uchar_pointer_convert(TX_NAME_CONST CHAR *pointer); */
/** */
/***********************************************************************************************/
/***********************************************************************************************/
-UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer)
+const UCHAR *_tx_misra_char_to_uchar_pointer_convert(TX_NAME_CONST CHAR *pointer)
{
/* Return a UCHAR pointer. */
- return((UCHAR *) ((VOID *) pointer));
+ return((const UCHAR *) ((const VOID *) pointer));
+}
+
+
+/***********************************************************************************************/
+/***********************************************************************************************/
+/** */
+/** const UCHAR *_tx_misra_const_uchar_pointer_add(const UCHAR *ptr, ULONG amount); */
+/** */
+/***********************************************************************************************/
+/***********************************************************************************************/
+const UCHAR *_tx_misra_const_uchar_pointer_add(const UCHAR *ptr, ULONG amount)
+{
+ ptr = ptr + amount;
+ return(ptr);
}
diff --git a/common_smp/src/tx_mutex_create.c b/common_smp/src/tx_mutex_create.c
index 436c01f5..a1f5eba8 100644
--- a/common_smp/src/tx_mutex_create.c
+++ b/common_smp/src/tx_mutex_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -65,7 +67,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit)
+UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR *name_ptr, UINT inherit)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/tx_mutex_info_get.c b/common_smp/src/tx_mutex_info_get.c
index a24d1e30..3be2606b 100644
--- a/common_smp/src/tx_mutex_info_get.c
+++ b/common_smp/src/tx_mutex_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
+UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR **name, ULONG *count, TX_THREAD **owner,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_MUTEX **next_mutex)
{
diff --git a/common_smp/src/tx_queue_create.c b/common_smp/src/tx_queue_create.c
index 59ae154e..afb5648d 100644
--- a/common_smp/src/tx_queue_create.c
+++ b/common_smp/src/tx_queue_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -66,7 +68,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
+UINT _tx_queue_create(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR *name_ptr, UINT message_size,
VOID *queue_start, ULONG queue_size)
{
diff --git a/common_smp/src/tx_queue_info_get.c b/common_smp/src/tx_queue_info_get.c
index d0ecb2b6..e25da54e 100644
--- a/common_smp/src/tx_queue_info_get.c
+++ b/common_smp/src/tx_queue_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -69,7 +71,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
+UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR **name, ULONG *enqueued, ULONG *available_storage,
TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue)
{
diff --git a/common_smp/src/tx_semaphore_create.c b/common_smp/src/tx_semaphore_create.c
index 849f5d3b..14553ca8 100644
--- a/common_smp/src/tx_semaphore_create.c
+++ b/common_smp/src/tx_semaphore_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -64,7 +66,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count)
+UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR *name_ptr, ULONG initial_count)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/tx_semaphore_info_get.c b/common_smp/src/tx_semaphore_info_get.c
index 89fd9423..2ffad1f7 100644
--- a/common_smp/src/tx_semaphore_info_get.c
+++ b/common_smp/src/tx_semaphore_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -69,7 +71,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
+UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR **name, ULONG *current_value,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_SEMAPHORE **next_semaphore)
{
diff --git a/common_smp/src/tx_thread_create.c b/common_smp/src/tx_thread_create.c
index 28a1dae1..3b158f47 100644
--- a/common_smp/src/tx_thread_create.c
+++ b/common_smp/src/tx_thread_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -77,7 +79,7 @@
/* _tx_timer_initialize Create system timer thread */
/* */
/**************************************************************************/
-UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
+UINT _tx_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG id), ULONG entry_input,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start)
@@ -93,19 +95,27 @@ UCHAR *temp_ptr;
ALIGN_TYPE new_stack_start;
ALIGN_TYPE updated_stack_start;
#endif
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) && !defined(TX_DISABLE_STACK_FILLING)
+ULONG stack_fill_value;
+#endif
#ifndef TX_DISABLE_STACK_FILLING
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
/* Initialize the stack fill value to a 8-bit random value. */
- thread_ptr -> tx_thread_stack_fill_value = ((ULONG) TX_RAND()) & 0xFFUL;
+ stack_fill_value = ((ULONG) TX_RAND()) & 0xFFUL;
/* Duplicate the random value in each of the 4 bytes of the stack fill value. */
- thread_ptr -> tx_thread_stack_fill_value = thread_ptr -> tx_thread_stack_fill_value |
- (thread_ptr -> tx_thread_stack_fill_value << 8) |
- (thread_ptr -> tx_thread_stack_fill_value << 16) |
- (thread_ptr -> tx_thread_stack_fill_value << 24);
+ stack_fill_value = stack_fill_value |
+ (stack_fill_value << 8) |
+ (stack_fill_value << 16) |
+ (stack_fill_value << 24);
+
+ /* Store the fill value in the control block so that the stack fill below picks it up
+ through the TX_STACK_FILL macro. The control block is cleared further down in this
+ function, so the value is stored again once that has been done. */
+ thread_ptr -> tx_thread_stack_fill_value = stack_fill_value;
#endif
/* Set the thread stack to a pattern prior to creating the initial
@@ -122,7 +132,7 @@ ALIGN_TYPE updated_stack_start;
stack_size = ((stack_size/(sizeof(ULONG))) * (sizeof(ULONG))) - (sizeof(ULONG));
/* Ensure the starting stack address is evenly aligned. */
- new_stack_start = TX_POINTER_TO_ALIGN_TYPE_CONVERT(stack_start);
+ new_stack_start = (ALIGN_TYPE) ((VOID *) stack_start);
updated_stack_start = (((new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
/* Determine if the starting stack address is different. */
@@ -134,7 +144,7 @@ ALIGN_TYPE updated_stack_start;
}
/* Update the starting stack pointer. */
- stack_start = TX_ALIGN_TYPE_TO_POINTER_CONVERT(updated_stack_start);
+ stack_start = (VOID *) ((ALIGN_TYPE) updated_stack_start);
#endif
/* Prepare the thread control block prior to placing it on the created
@@ -143,6 +153,14 @@ ALIGN_TYPE updated_stack_start;
/* Initialize thread control block to all zeros. */
TX_MEMSET(thread_ptr, 0, sizeof(TX_THREAD));
+#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) && !defined(TX_DISABLE_STACK_FILLING)
+
+ /* Clearing the control block reset the stack fill value, so store the value that was
+ actually used to fill the stack again. Otherwise the stack checking and stack analyze
+ routines would look for a pattern that is not the one present in the stack. */
+ thread_ptr -> tx_thread_stack_fill_value = stack_fill_value;
+#endif
+
/* Place the supplied parameters into the thread's control block. */
thread_ptr -> tx_thread_name = name_ptr;
thread_ptr -> tx_thread_entry = entry_function;
diff --git a/common_smp/src/tx_thread_delete.c b/common_smp/src/tx_thread_delete.c
index 510f6565..5bbb12c3 100644
--- a/common_smp/src/tx_thread_delete.c
+++ b/common_smp/src/tx_thread_delete.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -95,6 +97,31 @@ UINT status;
}
}
+ /* The state is terminal, but a terminal state on its own is not authorization to
+ release the control block. Both paths that produce one -- thread completion in
+ _tx_thread_shell_entry and thread termination in _tx_thread_terminate -- publish
+ TX_COMPLETED or TX_TERMINATED, and then run this thread's exit notification
+ callback, before the thread has been detached from the ready list and before
+ those services have finished with the pointer they hold to it. The suspending
+ flag is set for exactly that interval, so a thread whose flag is still set is
+ part-way through the transition. */
+ if (status == TX_SUCCESS)
+ {
+
+ /* Is the completion or termination transition still in progress? */
+ if (thread_ptr -> tx_thread_suspending == TX_TRUE)
+ {
+
+ /* Restore interrupts. */
+ TX_RESTORE
+
+ /* Yes, refuse the delete rather than unlink a thread the scheduler is
+ still holding. The condition is transient: the caller may retry once
+ the transition has finished. */
+ status = TX_DELETE_ERROR;
+ }
+ }
+
/* Determine if the delete operation is okay. */
if (status == TX_SUCCESS)
{
diff --git a/common_smp/src/tx_thread_info_get.c b/common_smp/src/tx_thread_info_get.c
index 740a3b95..cd0df6ec 100644
--- a/common_smp/src/tx_thread_info_get.c
+++ b/common_smp/src/tx_thread_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -72,7 +74,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
+UINT _tx_thread_info_get(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR **name, UINT *state, ULONG *run_count,
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
{
diff --git a/common_smp/src/tx_thread_relinquish.c b/common_smp/src/tx_thread_relinquish.c
index 10982b26..f07d2b56 100644
--- a/common_smp/src/tx_thread_relinquish.c
+++ b/common_smp/src/tx_thread_relinquish.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -290,8 +292,10 @@ UINT finished;
}
} while ((next_thread != thread_ptr) && (finished == TX_FALSE));
- /* Determine if we are finished. */
- if (finished == TX_FALSE)
+ /* Determine if we are finished. A rebalance request means the loop stopped
+ at a thread it could not place rather than running out of threads, so the
+ execute list still has to be rebuilt and this is not that case. */
+ if ((finished == TX_FALSE) && (rebalance == TX_FALSE))
{
/* No other thread is ready at this priority... simply return. */
diff --git a/common_smp/src/tx_thread_reset.c b/common_smp/src/tx_thread_reset.c
index da56daf5..8e59f1e7 100644
--- a/common_smp/src/tx_thread_reset.c
+++ b/common_smp/src/tx_thread_reset.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -104,6 +106,28 @@ UINT status;
status = TX_NOT_DONE;
}
}
+
+ /* The state is terminal, but a terminal state on its own is not authorization
+ to rebuild the stack and move the thread back to TX_SUSPENDED. Both paths
+ that produce one -- thread completion in _tx_thread_shell_entry and thread
+ termination in _tx_thread_terminate -- publish TX_COMPLETED or
+ TX_TERMINATED, and then run this thread's exit notification callback, before
+ the thread has been detached from the ready list. The suspending flag is
+ set for exactly that interval. Resetting inside it would also defeat the
+ protection _tx_thread_system_resume relies on, which refuses to cancel a
+ suspension only while the state is still terminal. */
+ if (status == TX_SUCCESS)
+ {
+
+ /* Is the completion or termination transition still in progress? */
+ if (thread_ptr -> tx_thread_suspending == TX_TRUE)
+ {
+
+ /* Yes, refuse the reset. The condition is transient: the caller may
+ retry once the transition has finished. */
+ status = TX_NOT_DONE;
+ }
+ }
}
/* Is the request valid? */
diff --git a/common_smp/src/tx_thread_shell_entry.c b/common_smp/src/tx_thread_shell_entry.c
index 45fe9d6d..2a16a00b 100644
--- a/common_smp/src/tx_thread_shell_entry.c
+++ b/common_smp/src/tx_thread_shell_entry.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -134,6 +136,17 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type);
#ifdef TX_NOT_INTERRUPTABLE
+ /* Set the suspending flag, so that the completion transition is marked as in
+ progress for the same interval it is marked in the interruptable
+ configuration below. Nothing in this configuration needs the flag to cancel
+ an interrupted suspension -- interrupts stay disabled through the whole
+ transition -- but the notification callback and the completion extension
+ below are application code, reached by a direct call, and interrupt lockout
+ does not stop either of them from calling a thread lifecycle service on this
+ same control block. The flag is what _tx_thread_delete and _tx_thread_reset
+ test in order to refuse one. */
+ thread_ptr -> tx_thread_suspending = TX_TRUE;
+
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Determine if an application callback routine is specified. */
@@ -148,6 +161,15 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type);
/* Perform any additional activities for tool or user purpose. */
TX_THREAD_COMPLETED_EXTENSION(thread_ptr)
+ /* Clear the suspending flag. It has to be cleared here rather than after the
+ call below, because _tx_thread_system_ni_suspend returns to the scheduler for
+ a thread that is the current thread, which this one is, and so does not come
+ back. Clearing it afterwards would leave a normally completed thread marked
+ as transitioning for ever and therefore permanently undeletable. Clearing it
+ here loses nothing: everything from this point to the detachment runs with
+ interrupts disabled and calls no application code. */
+ thread_ptr -> tx_thread_suspending = TX_FALSE;
+
/* Call actual non-interruptable thread suspension routine. */
_tx_thread_system_ni_suspend(thread_ptr, ((ULONG) 0));
diff --git a/common_smp/src/tx_thread_sleep.c b/common_smp/src/tx_thread_sleep.c
index fd986a0b..9e3a0afd 100644
--- a/common_smp/src/tx_thread_sleep.c
+++ b/common_smp/src/tx_thread_sleep.c
@@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
/**************************************************************************/
/**************************************************************************/
@@ -155,6 +156,9 @@ TX_THREAD *thread_ptr;
#ifdef TX_NOT_INTERRUPTABLE
+ /* Initialize the status to successful. */
+ thread_ptr -> tx_thread_suspend_status = TX_SUCCESS;
+
/* Call actual non-interruptable thread suspension routine. */
_tx_thread_system_ni_suspend(thread_ptr, timer_ticks);
diff --git a/common_smp/src/tx_thread_smp_utilities.c b/common_smp/src/tx_thread_smp_utilities.c
index 833a9aab..0569a819 100644
--- a/common_smp/src/tx_thread_smp_utilities.c
+++ b/common_smp/src/tx_thread_smp_utilities.c
@@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
/**************************************************************************/
/**************************************************************************/
@@ -654,6 +655,11 @@ TX_THREAD *last_thread;
TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
+ /* Limit the supplied core maps to the cores that are actually present. */
+ available_cores = available_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+ thread_possible_cores = thread_possible_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+ test_possible_cores = test_possible_cores & ((ULONG) TX_THREAD_SMP_CORE_MASK);
+
/* Clear the last thread cores in the search. */
last_thread_cores = ((ULONG) 0);
@@ -664,6 +670,9 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
queue_first = ((UINT) 0);
queue_last = ((UINT) 0);
+ /* Initialize the first core queue entry. */
+ core_queue[0] = ((UINT) 0);
+
/* Build a list of possible cores for this thread to execute on, starting
with the previously mapped core. */
core = schedule_thread -> tx_thread_smp_core_mapped;
diff --git a/common_smp/src/tx_thread_stack_analyze.c b/common_smp/src/tx_thread_stack_analyze.c
index 080d0052..ecd7ee13 100644
--- a/common_smp/src/tx_thread_stack_analyze.c
+++ b/common_smp/src/tx_thread_stack_analyze.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -70,6 +72,10 @@ TX_INTERRUPT_SAVE_AREA
ULONG *stack_ptr;
ULONG *stack_lowest;
ULONG *stack_highest;
+ULONG *probe_ptr;
+ULONG *stack_limit;
+ULONG probe_count;
+UINT fill_present;
ULONG size;
@@ -94,10 +100,16 @@ ULONG size;
/* Pickup the highest stack pointer. */
stack_highest = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_stack_highest_ptr);
- /* Determine if the pointer is null. */
- if (stack_highest != TX_NULL)
+ /* Determine if the pointer is null or if the highest stack pointer is not above the
+ start of the stack. The latter indicates a stack overflow or a corrupted thread
+ control block, and the unsigned pointer arithmetic in the binary search below would
+ wrap around and never converge, hanging the caller. */
+ if ((stack_highest != TX_NULL) && (stack_highest > stack_lowest))
{
+ /* Remember the upper bound of the search so the scan below cannot run past it. */
+ stack_limit = stack_highest;
+
/* Restore interrupts. */
TX_RESTORE
@@ -110,8 +122,49 @@ ULONG size;
size = (ULONG) (TX_ULONG_POINTER_DIF(stack_highest, stack_lowest))/((ULONG) 2);
stack_ptr = TX_ULONG_POINTER_ADD(stack_lowest, size);
- /* Determine if the pattern is still there. */
- if (*stack_ptr != TX_STACK_FILL)
+ /* Determine if the pattern is still there. To avoid stopping on an
+ unwritten hole inside an otherwise used region, require several
+ consecutive fill words, working towards the lowest address. The scan
+ stops at the lowest known fill location, since everything at or below
+ that point is already known to hold the fill pattern. */
+ fill_present = TX_TRUE;
+ probe_ptr = stack_ptr;
+ probe_count = TX_THREAD_STACK_ANALYZE_FILL_WORDS;
+ while (probe_count != ((ULONG) 0))
+ {
+
+ /* Determine if this word still holds the fill pattern. */
+ if (*probe_ptr != TX_STACK_FILL)
+ {
+
+ /* No, the probe location is in use. */
+ fill_present = TX_FALSE;
+ probe_count = ((ULONG) 0);
+ }
+ else
+ {
+
+ /* Yes, account for this word. */
+ probe_count--;
+
+ /* Determine if the lowest known fill location has been reached. */
+ if (probe_ptr <= stack_lowest)
+ {
+
+ /* Yes, nothing further to check. */
+ probe_count = ((ULONG) 0);
+ }
+ else
+ {
+
+ /* Position to the previous word in the stack. */
+ probe_ptr = TX_ULONG_POINTER_SUB(probe_ptr, 1);
+ }
+ }
+ }
+
+ /* Determine if the probe location is in use. */
+ if (fill_present == TX_FALSE)
{
/* Update the stack highest, since we need to look in the upper half now. */
@@ -127,7 +180,7 @@ ULONG size;
} while(size > ((ULONG) 1));
/* Position to first used word - at this point we are within a few words. */
- while (*stack_ptr == TX_STACK_FILL)
+ while ((stack_ptr < stack_limit) && (*stack_ptr == TX_STACK_FILL))
{
/* Position to next word in stack. */
diff --git a/common_smp/src/tx_thread_terminate.c b/common_smp/src/tx_thread_terminate.c
index 86e34bae..c87efaa0 100644
--- a/common_smp/src/tx_thread_terminate.c
+++ b/common_smp/src/tx_thread_terminate.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -133,6 +135,16 @@ ULONG suspension_sequence;
#ifdef TX_NOT_INTERRUPTABLE
+ /* Set the suspending flag, so that the termination transition is marked
+ as in progress for the same interval it is marked in the interruptable
+ configuration below. Nothing in this configuration needs the flag to
+ cancel an interrupted suspension -- interrupts stay disabled through
+ the whole transition -- but the notification callback below is
+ application code, reached by a direct call, and interrupt lockout does
+ not stop it from calling a thread lifecycle service on this same
+ control block. The flag is cleared in the common tail below. */
+ thread_ptr -> tx_thread_suspending = TX_TRUE;
+
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
/* Determine if an application callback routine is specified. */
@@ -225,20 +237,13 @@ ULONG suspension_sequence;
(suspend_cleanup)(thread_ptr, suspension_sequence);
}
-#ifndef TX_NOT_INTERRUPTABLE
-
- /* Disable interrupts. */
- TX_DISABLE
-#endif
-
- /* Clear the suspending flag. */
- thread_ptr -> tx_thread_suspending = TX_FALSE;
-
-#ifndef TX_NOT_INTERRUPTABLE
-
- /* Restore interrupts. */
- TX_RESTORE
-#endif
+ /* The suspending flag deliberately stays set here. It used to be
+ cleared at this point, which left the terminated extension and the
+ notification callback below -- both application code -- free to delete
+ or reset this control block while this service still held a pointer to
+ it and still had mutex-release processing to do. It is now cleared
+ once, in the common tail below, after the last dereference of the
+ target. */
/* Perform any additional activities for tool or user purpose. */
TX_THREAD_TERMINATED_EXTENSION(thread_ptr)
@@ -282,6 +287,20 @@ ULONG suspension_sequence;
TX_DISABLE
#endif
+ /* Clear the suspending flag. This is the one place the end of the
+ termination transition is published, and it is reached from both branches
+ above, after the notification callback and after the mutex-release
+ processing, which is the last thing in this service to dereference the
+ target. Until this store, _tx_thread_delete and _tx_thread_reset refuse
+ the target. In the interruptable ready branch the flag is already false,
+ because _tx_thread_system_suspend cleared it when it detached the thread,
+ so this is a second store of a value the flag already holds; that is
+ cheaper than testing for it and it keeps the transition to a single clear
+ site. No suspension-initiating service can have set it again in between:
+ every one of them acts on a thread that is ready or suspended, and this
+ thread is terminated. */
+ thread_ptr -> tx_thread_suspending = TX_FALSE;
+
/* Enable preemption. */
_tx_thread_preempt_disable--;
diff --git a/common_smp/src/tx_timer_create.c b/common_smp/src/tx_timer_create.c
index 73fa67cd..81af4c9b 100644
--- a/common_smp/src/tx_timer_create.c
+++ b/common_smp/src/tx_timer_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -68,7 +70,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
+UINT _tx_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(ULONG id), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate)
{
diff --git a/common_smp/src/tx_timer_info_get.c b/common_smp/src/tx_timer_info_get.c
index 31c801f9..0811b592 100644
--- a/common_smp/src/tx_timer_info_get.c
+++ b/common_smp/src/tx_timer_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -68,7 +70,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
+UINT _tx_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
ULONG *reschedule_ticks, TX_TIMER **next_timer)
{
diff --git a/common_smp/src/tx_trace_object_register.c b/common_smp/src/tx_trace_object_register.c
index f7cd4a4a..a2a1e0b4 100644
--- a/common_smp/src/tx_trace_object_register.c
+++ b/common_smp/src/tx_trace_object_register.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -66,7 +68,7 @@
/* Application Code */
/* */
/**************************************************************************/
-VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2)
+VOID _tx_trace_object_register(UCHAR object_type, VOID *object_ptr, TX_NAME_CONST CHAR *object_name, ULONG parameter_1, ULONG parameter_2)
{
#ifdef TX_ENABLE_EVENT_TRACE
@@ -75,6 +77,7 @@ UINT i, entries;
UINT found, loop_break;
TX_THREAD *thread_ptr;
UCHAR *work_ptr;
+const UCHAR *name_ptr;
TX_TRACE_OBJECT_ENTRY *entry_ptr;
@@ -211,21 +214,21 @@ TX_TRACE_OBJECT_ENTRY *entry_ptr;
for (i = ((ULONG) 0); i < (((ULONG) TX_TRACE_OBJECT_REGISTRY_NAME)-((ULONG) 1)); i++)
{
- /* Setup work pointer to the object name character. */
- work_ptr = TX_CHAR_TO_UCHAR_POINTER_CONVERT(object_name);
- work_ptr = TX_UCHAR_POINTER_ADD(work_ptr, i);
+ /* Setup name pointer to the object name character. */
+ name_ptr = TX_CHAR_TO_UCHAR_POINTER_CONVERT(object_name);
+ name_ptr = TX_CONST_UCHAR_POINTER_ADD(name_ptr, i);
- /* Determine if object_name (work_ptr) is null. */
- if (work_ptr == TX_NULL)
+ /* Determine if object_name (name_ptr) is null. */
+ if (name_ptr == TX_NULL)
{
break;
}
/* Copy a character of the name. */
- entry_ptr -> tx_trace_object_entry_name[i] = (UCHAR) *work_ptr;
+ entry_ptr -> tx_trace_object_entry_name[i] = (UCHAR) *name_ptr;
/* Determine if we are at the end. */
- if (*work_ptr == ((UCHAR) 0))
+ if (*name_ptr == ((UCHAR) 0))
{
break;
}
diff --git a/common_smp/src/txe_block_pool_create.c b/common_smp/src/txe_block_pool_create.c
index 08ef7e69..b4c7e13f 100644
--- a/common_smp/src/txe_block_pool_create.c
+++ b/common_smp/src/txe_block_pool_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -74,7 +76,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
diff --git a/common_smp/src/txe_block_pool_info_get.c b/common_smp/src/txe_block_pool_info_get.c
index f91ca206..4c6003d7 100644
--- a/common_smp/src/txe_block_pool_info_get.c
+++ b/common_smp/src/txe_block_pool_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
+UINT _txe_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)
{
diff --git a/common_smp/src/txe_byte_pool_create.c b/common_smp/src/txe_byte_pool_create.c
index 99a89698..9ae72ee9 100644
--- a/common_smp/src/txe_byte_pool_create.c
+++ b/common_smp/src/txe_byte_pool_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -73,7 +75,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size)
+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)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/txe_byte_pool_info_get.c b/common_smp/src/txe_byte_pool_info_get.c
index 85e7a233..a83c907b 100644
--- a/common_smp/src/txe_byte_pool_info_get.c
+++ b/common_smp/src/txe_byte_pool_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
+UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, TX_NAME_CONST CHAR **name, ULONG *available_bytes,
ULONG *fragments, TX_THREAD **first_suspended,
ULONG *suspended_count, TX_BYTE_POOL **next_pool)
{
diff --git a/common_smp/src/txe_event_flags_create.c b/common_smp/src/txe_event_flags_create.c
index 4e3fed77..20984738 100644
--- a/common_smp/src/txe_event_flags_create.c
+++ b/common_smp/src/txe_event_flags_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/txe_event_flags_info_get.c b/common_smp/src/txe_event_flags_info_get.c
index e551d025..d7bddca4 100644
--- a/common_smp/src/txe_event_flags_info_get.c
+++ b/common_smp/src/txe_event_flags_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -72,7 +74,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
+UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, TX_NAME_CONST CHAR **name, ULONG *current_flags,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_EVENT_FLAGS_GROUP **next_group)
{
diff --git a/common_smp/src/txe_mutex_create.c b/common_smp/src/txe_mutex_create.c
index 392f8b0e..a0461294 100644
--- a/common_smp/src/txe_mutex_create.c
+++ b/common_smp/src/txe_mutex_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -71,7 +73,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/txe_mutex_info_get.c b/common_smp/src/txe_mutex_info_get.c
index f4ef4168..93b43f91 100644
--- a/common_smp/src/txe_mutex_info_get.c
+++ b/common_smp/src/txe_mutex_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -71,7 +73,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
+UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, TX_NAME_CONST CHAR **name, ULONG *count, TX_THREAD **owner,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_MUTEX **next_mutex)
{
diff --git a/common_smp/src/txe_queue_create.c b/common_smp/src/txe_queue_create.c
index 387eacb6..ca3b8531 100644
--- a/common_smp/src/txe_queue_create.c
+++ b/common_smp/src/txe_queue_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -72,7 +74,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
diff --git a/common_smp/src/txe_queue_info_get.c b/common_smp/src/txe_queue_info_get.c
index 78d98392..90fdd410 100644
--- a/common_smp/src/txe_queue_info_get.c
+++ b/common_smp/src/txe_queue_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
+UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, TX_NAME_CONST CHAR **name, ULONG *enqueued, ULONG *available_storage,
TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue)
{
diff --git a/common_smp/src/txe_semaphore_create.c b/common_smp/src/txe_semaphore_create.c
index a190b03c..d538f5fe 100644
--- a/common_smp/src/txe_semaphore_create.c
+++ b/common_smp/src/txe_semaphore_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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)
{
TX_INTERRUPT_SAVE_AREA
diff --git a/common_smp/src/txe_semaphore_info_get.c b/common_smp/src/txe_semaphore_info_get.c
index 7695028e..85747dc3 100644
--- a/common_smp/src/txe_semaphore_info_get.c
+++ b/common_smp/src/txe_semaphore_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -70,7 +72,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
+UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, TX_NAME_CONST CHAR **name, ULONG *current_value,
TX_THREAD **first_suspended, ULONG *suspended_count,
TX_SEMAPHORE **next_semaphore)
{
diff --git a/common_smp/src/txe_thread_create.c b/common_smp/src/txe_thread_create.c
index d319bc9e..cc5033b2 100644
--- a/common_smp/src/txe_thread_create.c
+++ b/common_smp/src/txe_thread_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -79,7 +81,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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 id), ULONG entry_input,
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
diff --git a/common_smp/src/txe_thread_info_get.c b/common_smp/src/txe_thread_info_get.c
index ad1db3f7..19e248eb 100644
--- a/common_smp/src/txe_thread_info_get.c
+++ b/common_smp/src/txe_thread_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -74,7 +76,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
+UINT _txe_thread_info_get(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR **name, UINT *state, ULONG *run_count,
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
{
diff --git a/common_smp/src/txe_timer_change.c b/common_smp/src/txe_timer_change.c
index ef503ffa..7f6d6a36 100644
--- a/common_smp/src/txe_timer_change.c
+++ b/common_smp/src/txe_timer_change.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -26,8 +28,6 @@
/* Include necessary system files. */
#include "tx_api.h"
-#include "tx_initialize.h"
-#include "tx_thread.h"
#include "tx_timer.h"
@@ -56,7 +56,6 @@
/* */
/* TX_TIMER_ERROR Invalid application timer pointer */
/* TX_TICK_ERROR Invalid initial tick value of 0 */
-/* TX_CALLER_ERROR Invalid caller of this function */
/* status Actual completion status */
/* */
/* CALLS */
@@ -98,13 +97,6 @@ UINT status;
status = TX_TICK_ERROR;
}
- /* Check for invalid caller of this function. */
- else if (TX_THREAD_GET_SYSTEM_STATE() >= TX_INITIALIZE_IN_PROGRESS)
- {
-
- /* Invalid caller of this function, return appropriate error code. */
- status = TX_CALLER_ERROR;
- }
else
{
diff --git a/common_smp/src/txe_timer_create.c b/common_smp/src/txe_timer_create.c
index 02cf7c1a..8c481bde 100644
--- a/common_smp/src/txe_timer_create.c
+++ b/common_smp/src/txe_timer_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -74,7 +76,7 @@
/* Application Code */
/* */
/**************************************************************************/
-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 id), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size)
{
diff --git a/common_smp/src/txe_timer_info_get.c b/common_smp/src/txe_timer_info_get.c
index 16ac5f64..be2e9a13 100644
--- a/common_smp/src/txe_timer_info_get.c
+++ b/common_smp/src/txe_timer_info_get.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -69,7 +71,7 @@
/* Application Code */
/* */
/**************************************************************************/
-UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
+UINT _txe_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
ULONG *reschedule_ticks, TX_TIMER **next_timer)
{