summaryrefslogtreecommitdiff
path: root/ports/linux/gnu/src
diff options
context:
space:
mode:
Diffstat (limited to 'ports/linux/gnu/src')
-rw-r--r--ports/linux/gnu/src/tx_initialize_low_level.c113
-rw-r--r--ports/linux/gnu/src/tx_thread_context_restore.c79
-rw-r--r--ports/linux/gnu/src/tx_thread_context_save.c71
-rw-r--r--ports/linux/gnu/src/tx_thread_interrupt_control.c87
-rw-r--r--ports/linux/gnu/src/tx_thread_schedule.c19
-rw-r--r--ports/linux/gnu/src/tx_thread_stack_build.c73
-rw-r--r--ports/linux/gnu/src/tx_thread_system_return.c107
-rw-r--r--ports/linux/gnu/src/tx_timer_interrupt.c77
8 files changed, 293 insertions, 333 deletions
diff --git a/ports/linux/gnu/src/tx_initialize_low_level.c b/ports/linux/gnu/src/tx_initialize_low_level.c
index d3516aaa..32de408f 100644
--- a/ports/linux/gnu/src/tx_initialize_low_level.c
+++ b/ports/linux/gnu/src/tx_initialize_low_level.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Initialize */
/** */
@@ -42,18 +43,18 @@ sem_t _tx_linux_semaphore_no_idle;
ULONG _tx_linux_global_int_disabled_flag;
struct timespec _tx_linux_time_stamp;
__thread int _tx_linux_threadx_thread = 0;
-
+
/* Define signals for linux thread. */
#define SUSPEND_SIG SIGUSR1
#define RESUME_SIG SIGUSR2
static sigset_t _tx_linux_thread_wait_mask;
-static __thread int _tx_linux_thread_suspended;
+static __thread int _tx_linux_thread_suspended;
static sem_t _tx_linux_thread_timer_wait;
static sem_t _tx_linux_thread_other_wait;
/* Define simulated timer interrupt. This is done inside a thread, which is
- how other interrupts may be defined as well. See code below for an
+ how other interrupts may be defined as well. See code below for an
example. */
pthread_t _tx_linux_timer_id;
@@ -136,11 +137,11 @@ pthread_mutex_t temp_copy;
/* Now move to the next entry. */
_tx_linux_debug_entry_index++;
-
+
/* Determine if we need to wrap the list. */
if (_tx_linux_debug_entry_index >= TX_LINUX_DEBUG_EVENT_SIZE)
{
-
+
/* Yes, wrap the list! */
_tx_linux_debug_entry_index = 0;
}
@@ -169,54 +170,48 @@ VOID _tx_thread_context_restore(VOID);
extern VOID *_tx_initialize_unused_memory;
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_initialize_low_level Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_initialize_low_level Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function is responsible for any low-level processor */
-/* initialization, including setting up interrupt vectors, setting */
-/* up a periodic timer interrupt source, saving the system stack */
-/* pointer for use in ISR processing later, and finding the first */
-/* available RAM memory address for tx_application_define. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* sched_setaffinity */
-/* getpid */
-/* _tx_linux_thread_init */
-/* pthread_setschedparam */
-/* pthread_mutexattr_init */
-/* pthread_mutex_init */
-/* _tx_linux_thread_suspend */
-/* sem_init */
-/* pthread_create */
-/* printf */
-/* */
-/* CALLED BY */
-/* */
-/* _tx_initialize_kernel_enter ThreadX entry function */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* This function is responsible for any low-level processor */
+/* initialization, including setting up interrupt vectors, setting */
+/* up a periodic timer interrupt source, saving the system stack */
+/* pointer for use in ISR processing later, and finding the first */
+/* available RAM memory address for tx_application_define. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* sched_setaffinity */
+/* getpid */
+/* _tx_linux_thread_init */
+/* pthread_setschedparam */
+/* pthread_mutexattr_init */
+/* pthread_mutex_init */
+/* _tx_linux_thread_suspend */
+/* sem_init */
+/* pthread_create */
+/* printf */
+/* */
+/* CALLED BY */
+/* */
+/* _tx_initialize_kernel_enter ThreadX entry function */
/* */
/**************************************************************************/
VOID _tx_initialize_low_level(VOID)
@@ -238,7 +233,7 @@ cpu_set_t mask;
CPU_SET(rand() % get_nprocs(), &mask);
if (sched_setaffinity(getpid(), sizeof(mask), &mask) != 0)
{
-
+
/* Error restricting the process to one core. */
printf("ThreadX Linux error restricting the process to one core!\n");
while(1)
@@ -260,7 +255,7 @@ cpu_set_t mask;
sp.sched_priority = TX_LINUX_PRIORITY_SCHEDULE;
pthread_setschedparam(pthread_self(), SCHED_FIFO, &sp);
- /* Create the system critical section. This is used by the
+ /* Create the system critical section. This is used by the
scheduler thread (which is the main thread) to block all
other stuff out. */
pthread_mutexattr_init(&attr);
@@ -273,10 +268,10 @@ cpu_set_t mask;
/* Initialize the global interrupt disabled flag. */
_tx_linux_global_int_disabled_flag = TX_FALSE;
-
+
/* Create semaphore for timer thread. */
sem_init(&_tx_linux_timer_semaphore, 0, 0);
-
+
/* Create semaphore for ISR thread. */
sem_init(&_tx_linux_isr_semaphore, 0, 0);
@@ -302,7 +297,7 @@ cpu_set_t mask;
/* This routine is called after initialization is complete in order to start
- all interrupt threads. Interrupt threads in addition to the timer may
+ all interrupt threads. Interrupt threads in addition to the timer may
be added to this routine as well. */
void _tx_initialize_start_interrupts(void)
@@ -377,7 +372,7 @@ int err;
tx_linux_mutex_unlock(_tx_linux_mutex);
#endif /* TX_LINUX_NO_IDLE_ENABLE */
- }
+ }
}
/* Define functions for linux thread. */
@@ -395,11 +390,11 @@ void _tx_linux_thread_suspend_handler(int sig)
else
tx_linux_sem_post_nolock(&_tx_linux_thread_other_wait);
- if(_tx_linux_thread_suspended)
+ if(_tx_linux_thread_suspended)
return;
_tx_linux_thread_suspended = 1;
- sigsuspend(&_tx_linux_thread_wait_mask);
+ sigsuspend(&_tx_linux_thread_wait_mask);
_tx_linux_thread_suspended = 0;
}
diff --git a/ports/linux/gnu/src/tx_thread_context_restore.c b/ports/linux/gnu/src/tx_thread_context_restore.c
index 5466b30e..3d7b44bb 100644
--- a/ports/linux/gnu/src/tx_thread_context_restore.c
+++ b/ports/linux/gnu/src/tx_thread_context_restore.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Thread */
/** */
@@ -31,50 +32,44 @@
extern sem_t _tx_linux_isr_semaphore;
UINT _tx_linux_timer_waiting = 0;
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_thread_context_restore Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_context_restore Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function restores the interrupt context if it is processing a */
-/* nested interrupt. If not, it returns to the interrupt thread if no */
-/* preemption is necessary. Otherwise, if preemption is necessary or */
-/* if no thread was running, the function returns to the scheduler. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* _tx_linux_debug_entry_insert */
-/* tx_linux_mutex_lock */
+/* */
+/* This function restores the interrupt context if it is processing a */
+/* nested interrupt. If not, it returns to the interrupt thread if no */
+/* preemption is necessary. Otherwise, if preemption is necessary or */
+/* if no thread was running, the function returns to the scheduler. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _tx_linux_debug_entry_insert */
+/* tx_linux_mutex_lock */
/* sem_trywait */
-/* tx_linux_sem_post */
-/* tx_linux_sem_wait */
-/* _tx_linux_thread_resume */
-/* tx_linux_mutex_recursive_unlock */
-/* */
-/* CALLED BY */
-/* */
-/* ISRs Interrupt Service Routines */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* tx_linux_sem_post */
+/* tx_linux_sem_wait */
+/* _tx_linux_thread_resume */
+/* tx_linux_mutex_recursive_unlock */
+/* */
+/* CALLED BY */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* ISRs Interrupt Service Routines */
/* */
/**************************************************************************/
VOID _tx_thread_context_restore(VOID)
@@ -101,7 +96,7 @@ VOID _tx_thread_context_restore(VOID)
if ((_tx_thread_preempt_disable == 0) && (_tx_thread_current_ptr != _tx_thread_execute_ptr))
{
- /* Preempt the running application thread. We don't need to suspend the
+ /* Preempt the running application thread. We don't need to suspend the
application thread since that is done in the context save processing. */
/* Indicate that this thread was suspended asynchronously. */
diff --git a/ports/linux/gnu/src/tx_thread_context_save.c b/ports/linux/gnu/src/tx_thread_context_save.c
index c98943fa..7bca3945 100644
--- a/ports/linux/gnu/src/tx_thread_context_save.c
+++ b/ports/linux/gnu/src/tx_thread_context_save.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Thread */
/** */
@@ -30,46 +31,40 @@
#include "tx_timer.h"
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_thread_context_save Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_context_save Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function saves the context of an executing thread in the */
-/* beginning of interrupt processing. The function also ensures that */
-/* the system stack is used upon return to the calling ISR. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* _tx_linux_debug_entry_insert */
-/* tx_linux_mutex_lock */
-/* _tx_linux_thread_suspend */
-/* tx_linux_mutex_unlock */
-/* */
-/* CALLED BY */
-/* */
-/* ISRs */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* This function saves the context of an executing thread in the */
+/* beginning of interrupt processing. The function also ensures that */
+/* the system stack is used upon return to the calling ISR. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _tx_linux_debug_entry_insert */
+/* tx_linux_mutex_lock */
+/* _tx_linux_thread_suspend */
+/* tx_linux_mutex_unlock */
+/* */
+/* CALLED BY */
+/* */
+/* ISRs */
/* */
/**************************************************************************/
VOID _tx_thread_context_save(VOID)
diff --git a/ports/linux/gnu/src/tx_thread_interrupt_control.c b/ports/linux/gnu/src/tx_thread_interrupt_control.c
index 657cf72e..75b62511 100644
--- a/ports/linux/gnu/src/tx_thread_interrupt_control.c
+++ b/ports/linux/gnu/src/tx_thread_interrupt_control.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Thread */
/** */
@@ -47,53 +48,47 @@ VOID _tx_thread_interrupt_restore(UINT previous_posture)
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_thread_interrupt_control Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_interrupt_control Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function is responsible for changing the interrupt lockout */
-/* posture of the system. */
-/* */
-/* INPUT */
-/* */
-/* new_posture New interrupt lockout posture */
-/* */
-/* OUTPUT */
-/* */
-/* old_posture Old interrupt lockout posture */
-/* */
-/* CALLS */
-/* */
-/* tx_linux_mutex_lock */
-/* pthread_self */
-/* pthread_getschedparam */
-/* tx_linux_mutex_recursive_unlock */
-/* pthread_exit */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* This function is responsible for changing the interrupt lockout */
+/* posture of the system. */
+/* */
+/* INPUT */
+/* */
+/* new_posture New interrupt lockout posture */
+/* */
+/* OUTPUT */
+/* */
+/* old_posture Old interrupt lockout posture */
+/* */
+/* CALLS */
+/* */
+/* tx_linux_mutex_lock */
+/* pthread_self */
+/* pthread_getschedparam */
+/* tx_linux_mutex_recursive_unlock */
+/* pthread_exit */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
UINT _tx_thread_interrupt_control(UINT new_posture)
{
UINT old_posture;
-TX_THREAD *thread_ptr;
+TX_THREAD *thread_ptr;
pthread_t thread_id;
int exit_code = 0;
@@ -107,18 +102,18 @@ int exit_code = 0;
/* Pickup the current thread pointer. */
thread_ptr = _tx_thread_current_ptr;
- /* Determine if this is a thread and it does not
+ /* Determine if this is a thread and it does not
match the current thread pointer. */
- if ((_tx_linux_threadx_thread) &&
- ((!thread_ptr) || (!pthread_equal(thread_ptr -> tx_thread_linux_thread_id, thread_id))))
- {
+ if ((_tx_linux_threadx_thread) &&
+ ((!thread_ptr) || (!pthread_equal(thread_ptr -> tx_thread_linux_thread_id, thread_id))))
+ {
- /* This indicates the Linux thread was actually terminated by ThreadX is only
+ /* This indicates the Linux thread was actually terminated by ThreadX is only
being allowed to run in order to cleanup its resources. */
/* Unlock linux mutex. */
tx_linux_mutex_recursive_unlock(_tx_linux_mutex);
pthread_exit((void *)&exit_code);
- }
+ }
/* Determine the current interrupt lockout condition. */
if (tx_linux_mutex_recursive_count == 1)
@@ -155,7 +150,7 @@ int exit_code = 0;
_tx_linux_global_int_disabled_flag = TX_TRUE;
}
}
- else if (thread_ptr)
+ else if (thread_ptr)
{
/* Determine how to apply the new posture. */
diff --git a/ports/linux/gnu/src/tx_thread_schedule.c b/ports/linux/gnu/src/tx_thread_schedule.c
index d65104a1..eeff680f 100644
--- a/ports/linux/gnu/src/tx_thread_schedule.c
+++ b/ports/linux/gnu/src/tx_thread_schedule.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -39,7 +40,7 @@ extern pthread_t _tx_linux_timer_id;
/* */
/* FUNCTION RELEASE */
/* */
-/* _tx_thread_schedule Linux/GNU */
+/* _tx_thread_schedule Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
@@ -73,12 +74,6 @@ extern pthread_t _tx_linux_timer_id;
/* */
/* _tx_initialize_kernel_enter ThreadX entry function */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
-/* */
/**************************************************************************/
VOID _tx_thread_schedule(VOID)
{
@@ -127,9 +122,9 @@ struct timespec ts;
ts.tv_sec++;
}
sem_timedwait(&_tx_linux_semaphore_no_idle, &ts);
-#else
+#else
nanosleep(&ts, &ts);
-#endif /* TX_LINUX_NO_IDLE_ENABLE */
+#endif /* TX_LINUX_NO_IDLE_ENABLE */
}
}
diff --git a/ports/linux/gnu/src/tx_thread_stack_build.c b/ports/linux/gnu/src/tx_thread_stack_build.c
index 424f53e2..cdadba6c 100644
--- a/ports/linux/gnu/src/tx_thread_stack_build.c
+++ b/ports/linux/gnu/src/tx_thread_stack_build.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Thread */
/** */
@@ -36,50 +37,44 @@
void *_tx_linux_thread_entry(void *ptr);
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_thread_stack_build Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_stack_build Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
+/* */
/* This function builds a stack frame on the supplied thread's stack. */
/* The stack frame results in a fake interrupt return to the supplied */
-/* function pointer. */
-/* */
-/* INPUT */
-/* */
+/* function pointer. */
+/* */
+/* INPUT */
+/* */
/* thread_ptr Pointer to thread control blk */
/* function_ptr Pointer to return function */
-/* */
-/* OUTPUT */
-/* */
+/* */
+/* OUTPUT */
+/* */
/* None */
-/* */
-/* CALLS */
-/* */
-/* pthread_create */
-/* pthread_setschedparam */
-/* _tx_linux_thread_suspend */
-/* sem_init */
-/* printf */
-/* _tx_linux_thread_resume */
-/* */
-/* CALLED BY */
-/* */
-/* _tx_thread_create Create thread service */
-/* _tx_thread_reset Reset thread service */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* CALLS */
+/* */
+/* pthread_create */
+/* pthread_setschedparam */
+/* _tx_linux_thread_suspend */
+/* sem_init */
+/* printf */
+/* _tx_linux_thread_resume */
+/* */
+/* CALLED BY */
+/* */
+/* _tx_thread_create Create thread service */
+/* _tx_thread_reset Reset thread service */
/* */
/**************************************************************************/
VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID))
@@ -115,11 +110,11 @@ struct sched_param sp;
sp.sched_priority = TX_LINUX_PRIORITY_USER_THREAD;
pthread_setschedparam(thread_ptr -> tx_thread_linux_thread_id, SCHED_FIFO, &sp);
- /* Setup the thread suspension type to solicited thread suspension.
+ /* Setup the thread suspension type to solicited thread suspension.
Pseudo interrupt handlers will suspend with this field set to 1. */
thread_ptr -> tx_thread_linux_suspension_type = 0;
- /* Clear the disabled count that will keep track of the
+ /* Clear the disabled count that will keep track of the
tx_interrupt_control nesting. */
thread_ptr -> tx_thread_linux_int_disabled_flag = 0;
diff --git a/ports/linux/gnu/src/tx_thread_system_return.c b/ports/linux/gnu/src/tx_thread_system_return.c
index 16d81d59..cc876721 100644
--- a/ports/linux/gnu/src/tx_thread_system_return.c
+++ b/ports/linux/gnu/src/tx_thread_system_return.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Thread */
/** */
@@ -30,54 +31,48 @@
#include <stdio.h>
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_thread_system_return Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_thread_system_return Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function is target processor specific. It is used to transfer */
-/* control from a thread back to the system. Only a minimal context */
-/* is saved since the compiler assumes temp registers are going to get */
-/* slicked by a function call anyway. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* _tx_linux_debug_entry_insert */
-/* tx_linux_mutex_lock */
-/* pthread_self */
-/* pthread_getschedparam */
-/* pthread_equal */
-/* tx_linux_mutex_recursive_unlock */
-/* tx_linux_mutex_unlock */
-/* pthread_exit */
-/* tx_linux_sem_post */
+/* */
+/* This function is target processor specific. It is used to transfer */
+/* control from a thread back to the system. Only a minimal context */
+/* is saved since the compiler assumes temp registers are going to get */
+/* slicked by a function call anyway. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _tx_linux_debug_entry_insert */
+/* tx_linux_mutex_lock */
+/* pthread_self */
+/* pthread_getschedparam */
+/* pthread_equal */
+/* tx_linux_mutex_recursive_unlock */
+/* tx_linux_mutex_unlock */
+/* pthread_exit */
+/* tx_linux_sem_post */
/* sem_trywait */
-/* tx_linux_sem_wait */
-/* */
-/* CALLED BY */
-/* */
-/* ThreadX components */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* tx_linux_sem_wait */
+/* */
+/* CALLED BY */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* ThreadX components */
/* */
/**************************************************************************/
VOID _tx_thread_system_return(VOID)
@@ -104,13 +99,13 @@ int exit_code = 0;
/* Pickup the current thread pointer. */
temp_thread_ptr = _tx_thread_current_ptr;
- /* Determine if this is a thread (0) and it does not
+ /* Determine if this is a thread (0) and it does not
match the current thread pointer. */
- if ((_tx_linux_threadx_thread) &&
- ((!temp_thread_ptr) || (!pthread_equal(temp_thread_ptr -> tx_thread_linux_thread_id, thread_id))))
- {
+ if ((_tx_linux_threadx_thread) &&
+ ((!temp_thread_ptr) || (!pthread_equal(temp_thread_ptr -> tx_thread_linux_thread_id, thread_id))))
+ {
- /* This indicates the Linux thread was actually terminated by ThreadX is only
+ /* This indicates the Linux thread was actually terminated by ThreadX is only
being allowed to run in order to cleanup its resources. */
/* Unlock linux mutex. */
tx_linux_mutex_recursive_unlock(_tx_linux_mutex);
@@ -176,19 +171,19 @@ int exit_code = 0;
/* Pickup the current thread pointer. */
temp_thread_ptr = _tx_thread_current_ptr;
- /* Determine if this is a thread and it does not
+ /* Determine if this is a thread and it does not
match the current thread pointer. */
- if ((_tx_linux_threadx_thread) &&
- ((!temp_thread_ptr) || (!pthread_equal(temp_thread_ptr -> tx_thread_linux_thread_id, thread_id))))
- {
+ if ((_tx_linux_threadx_thread) &&
+ ((!temp_thread_ptr) || (!pthread_equal(temp_thread_ptr -> tx_thread_linux_thread_id, thread_id))))
+ {
/* Unlock Linux mutex. */
tx_linux_mutex_recursive_unlock(_tx_linux_mutex);
- /* This indicates the Linux thread was actually terminated by ThreadX and is only
+ /* This indicates the Linux thread was actually terminated by ThreadX and is only
being allowed to run in order to cleanup its resources. */
pthread_exit((void *)&exit_code);
- }
+ }
/* Now determine if the application thread last had interrupts disabled. */
diff --git a/ports/linux/gnu/src/tx_timer_interrupt.c b/ports/linux/gnu/src/tx_timer_interrupt.c
index 8e55ca7f..d139fd9b 100644
--- a/ports/linux/gnu/src/tx_timer_interrupt.c
+++ b/ports/linux/gnu/src/tx_timer_interrupt.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Timer */
/** */
@@ -30,49 +31,43 @@
VOID _tx_timer_interrupt(VOID);
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_timer_interrupt Linux/GNU */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_timer_interrupt Linux/GNU */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function processes the hardware timer interrupt. This */
-/* processing includes incrementing the system clock and checking for */
-/* time slice and/or timer expiration. If either is found, the */
-/* interrupt context save/restore functions are called along with the */
-/* expiration functions. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* _tx_linux_debug_entry_insert */
-/* tx_linux_mutex_lock */
-/* tx_linux_mutex_unlock */
-/* _tx_timer_expiration_process */
-/* _tx_thread_time_slice */
-/* */
-/* CALLED BY */
-/* */
-/* interrupt vector */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* This function processes the hardware timer interrupt. This */
+/* processing includes incrementing the system clock and checking for */
+/* time slice and/or timer expiration. If either is found, the */
+/* interrupt context save/restore functions are called along with the */
+/* expiration functions. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _tx_linux_debug_entry_insert */
+/* tx_linux_mutex_lock */
+/* tx_linux_mutex_unlock */
+/* _tx_timer_expiration_process */
+/* _tx_thread_time_slice */
+/* */
+/* CALLED BY */
+/* */
+/* interrupt vector */
/* */
/**************************************************************************/
VOID _tx_timer_interrupt(VOID)