summaryrefslogtreecommitdiff
path: root/common_smp/inc/tx_thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'common_smp/inc/tx_thread.h')
-rw-r--r--common_smp/inc/tx_thread.h492
1 files changed, 246 insertions, 246 deletions
diff --git a/common_smp/inc/tx_thread.h b/common_smp/inc/tx_thread.h
index 3f90323c..207c36e7 100644
--- a/common_smp/inc/tx_thread.h
+++ b/common_smp/inc/tx_thread.h
@@ -12,7 +12,7 @@
/**************************************************************************/
/**************************************************************************/
-/** */
+/** */
/** ThreadX Component */
/** */
/** Thread */
@@ -21,24 +21,24 @@
/**************************************************************************/
-/**************************************************************************/
-/* */
-/* COMPONENT DEFINITION RELEASE */
-/* */
-/* tx_thread.h PORTABLE SMP */
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* tx_thread.h PORTABLE SMP */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This file defines the ThreadX thread control component, including */
+/* */
+/* This file defines the ThreadX thread control component, including */
/* data types and external references. It is assumed that tx_api.h */
/* and tx_port.h have already been included. */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 William E. Lamie Initial Version 6.1 */
@@ -64,9 +64,9 @@
#define TX_THREAD_SMP_PROTECT_WAIT_LIST_SIZE (TX_THREAD_SMP_MAX_CORES + 1)
-/* Define the default thread stack checking. This can be overridden by
- a particular port, which is necessary if the stack growth is from
- low address to high address (the default logic is for stacks that
+/* Define the default thread stack checking. This can be overridden by
+ a particular port, which is necessary if the stack growth is from
+ low address to high address (the default logic is for stacks that
grow from high address to low address. */
#ifndef TX_THREAD_STACK_CHECK
@@ -117,7 +117,7 @@
/* Define the thread create internal extension macro to whitespace, if it hasn't been defined previously (typically in tx_port.h). */
#ifndef TX_THREAD_CREATE_INTERNAL_EXTENSION
-#define TX_THREAD_CREATE_INTERNAL_EXTENSION(t)
+#define TX_THREAD_CREATE_INTERNAL_EXTENSION(t)
#endif
@@ -175,7 +175,7 @@ THREAD_DECLARE TX_THREAD * _tx_thread_current_ptr[TX_THREAD_SMP
/* Define the variable that holds the next thread to execute. It is important
- to remember that this is not necessarily equal to the current thread
+ to remember that this is not necessarily equal to the current thread
pointer. */
THREAD_DECLARE TX_THREAD * _tx_thread_execute_ptr[TX_THREAD_SMP_MAX_CORES];
@@ -220,7 +220,7 @@ THREAD_DECLARE ULONG _tx_thread_created_count;
/* Define the current state variable. When this value is 0, a thread
- is executing or the system is idle. Other values indicate that
+ is executing or the system is idle. Other values indicate that
interrupt or initialization processing is active. This variable is
initialized to TX_INITIALIZE_IN_PROGRESS to indicate initialization is
active. */
@@ -246,15 +246,15 @@ THREAD_DECLARE volatile ULONG _tx_thread_system_state[TX_THREAD_SM
/* Define the 32-bit priority bit-maps. There is one priority bit map for each
- 32 priority levels supported. If only 32 priorities are supported there is
- only one bit map. Each bit within a priority bit map represents that one
- or more threads at the associated thread priority are ready. */
+ 32 priority levels supported. If only 32 priorities are supported there is
+ only one bit map. Each bit within a priority bit map represents that one
+ or more threads at the associated thread priority are ready. */
THREAD_DECLARE ULONG _tx_thread_priority_maps[TX_MAX_PRIORITIES/32];
-/* Define the priority map active bit map that specifies which of the previously
- defined priority maps have something set. This is only necessary if more than
+/* Define the priority map active bit map that specifies which of the previously
+ defined priority maps have something set. This is only necessary if more than
32 priorities are supported. */
#if TX_MAX_PRIORITIES > 32
@@ -264,17 +264,17 @@ THREAD_DECLARE ULONG _tx_thread_priority_map_active;
#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
-/* Define the 32-bit preempt priority bit maps. There is one preempt bit map
- for each 32 priority levels supported. If only 32 priorities are supported
- there is only one bit map. Each set set bit corresponds to a preempted priority
- level that had preemption-threshold active to protect against preemption of a
+/* Define the 32-bit preempt priority bit maps. There is one preempt bit map
+ for each 32 priority levels supported. If only 32 priorities are supported
+ there is only one bit map. Each set set bit corresponds to a preempted priority
+ level that had preemption-threshold active to protect against preemption of a
range of relatively higher priority threads. */
THREAD_DECLARE ULONG _tx_thread_preempted_maps[TX_MAX_PRIORITIES/32];
-/* Define the preempt map active bit map that specifies which of the previously
- defined preempt maps have something set. This is only necessary if more than
+/* Define the preempt map active bit map that specifies which of the previously
+ defined preempt maps have something set. This is only necessary if more than
32 priorities are supported. */
#if TX_MAX_PRIORITIES > 32
@@ -283,7 +283,7 @@ THREAD_DECLARE ULONG _tx_thread_preempted_map_active;
/* Define the array that contains the thread at each priority level that was scheduled with
- preemption-threshold enabled. This will be useful when returning from a nested
+ preemption-threshold enabled. This will be useful when returning from a nested
preemption-threshold condition. */
THREAD_DECLARE TX_THREAD *_tx_thread_preemption_threshold_list[TX_MAX_PRIORITIES];
@@ -293,9 +293,9 @@ THREAD_DECLARE TX_THREAD *_tx_thread_preemption_threshold_lis
/* Define the last thread scheduled with preemption-threshold. When preemption-threshold is
- disabled, a thread with preemption-threshold set disables all other threads from running.
+ disabled, a thread with preemption-threshold set disables all other threads from running.
Effectively, its preemption-threshold is 0. */
-
+
THREAD_DECLARE TX_THREAD *_tx_thread_preemption__threshold_scheduled;
@@ -308,13 +308,13 @@ THREAD_DECLARE TX_THREAD * _tx_thread_priority_list[TX_MAX_PRIO
/* Define the global preempt disable variable. If this is non-zero, preemption is
- disabled. It is used internally by ThreadX to prevent preemption of a thread in
+ disabled. It is used internally by ThreadX to prevent preemption of a thread in
the middle of a service that is resuming or suspending another thread. */
THREAD_DECLARE volatile UINT _tx_thread_preempt_disable;
-/* Define the global function pointer for mutex cleanup on thread completion or
+/* Define the global function pointer for mutex cleanup on thread completion or
termination. This pointer is setup during mutex initialization. */
THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_ptr);
@@ -364,8 +364,8 @@ THREAD_DECLARE ULONG _tx_build_options;
#ifdef TX_ENABLE_STACK_CHECKING
-/* Define the global function pointer for stack error handling. If a stack error is
- detected and the application has registered a stack error handler, it will be
+/* Define the global function pointer for stack error handling. If a stack error is
+ detected and the application has registered a stack error handler, it will be
called via this function pointer. */
THREAD_DECLARE VOID (*_tx_thread_application_stack_error_handler)(TX_THREAD *thread_ptr);
@@ -380,20 +380,20 @@ THREAD_DECLARE VOID (*_tx_thread_application_stack_error
THREAD_DECLARE ULONG _tx_thread_performance_resume_count;
-/* Define the total number of thread suspensions. Each time a thread enters a
+/* Define the total number of thread suspensions. Each time a thread enters a
suspended state this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_suspend_count;
-/* Define the total number of solicited thread preemptions. Each time a thread is
+/* Define the total number of solicited thread preemptions. Each time a thread is
preempted by directly calling a ThreadX service, this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_solicited_preemption_count;
-/* Define the total number of interrupt thread preemptions. Each time a thread is
- preempted as a result of an ISR calling a ThreadX service, this variable is
+/* Define the total number of interrupt thread preemptions. Each time a thread is
+ preempted as a result of an ISR calling a ThreadX service, this variable is
incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_interrupt_preemption_count;
@@ -405,39 +405,39 @@ THREAD_DECLARE ULONG _tx_thread_performance_interrupt_pre
THREAD_DECLARE ULONG _tx_thread_performance_priority_inversion_count;
-/* Define the total number of time-slices. Each time a time-slice operation is
- actually performed (another thread is setup for running) this variable is
+/* Define the total number of time-slices. Each time a time-slice operation is
+ actually performed (another thread is setup for running) this variable is
incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_time_slice_count;
-/* Define the total number of thread relinquish operations. Each time a thread
+/* Define the total number of thread relinquish operations. Each time a thread
relinquish operation is actually performed (another thread is setup for running)
this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_relinquish_count;
-/* Define the total number of thread timeouts. Each time a thread has a
+/* Define the total number of thread timeouts. Each time a thread has a
timeout this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_timeout_count;
-/* Define the total number of thread wait aborts. Each time a thread's suspension
+/* Define the total number of thread wait aborts. Each time a thread's suspension
is lifted by the tx_thread_wait_abort call this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_wait_abort_count;
-/* Define the total number of idle system thread returns. Each time a thread returns to
+/* Define the total number of idle system thread returns. Each time a thread returns to
an idle system (no other thread is ready to run) this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_idle_return_count;
-/* Define the total number of non-idle system thread returns. Each time a thread returns to
+/* Define the total number of non-idle system thread returns. Each time a thread returns to
a non-idle system (another thread is ready to run) this variable is incremented. */
THREAD_DECLARE ULONG _tx_thread_performance_non_idle_return_count;
@@ -475,23 +475,23 @@ THREAD_DECLARE ULONG _tx_thread_performance_non_idle_retu
/* Define state change macro that can be used by run-mode debug agents to keep track of thread
state changes. By default, it is mapped to white space. */
-
+
#ifndef TX_THREAD_STATE_CHANGE
#define TX_THREAD_STATE_CHANGE(a, b)
#endif
-/* Define the macro to set the current thread pointer. This is particularly useful in SMP
+/* Define the macro to set the current thread pointer. This is particularly useful in SMP
versions of ThreadX to add additional processing. The default implementation is to simply
access the global current thread pointer directly. */
-
+
#ifndef TX_THREAD_SET_CURRENT
#define TX_THREAD_SET_CURRENT(a) TX_MEMSET(&_tx_thread_current_ptr[0], (a), sizeof(_tx_thread_current_ptr));
#endif
/* Define the get system state macro. By default, it is mapped to white space. */
-
+
#ifndef TX_THREAD_GET_SYSTEM_STATE
#define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_smp_current_state_get()
#endif
@@ -536,10 +536,10 @@ THREAD_DECLARE ULONG _tx_thread_performance_non_idle_retu
#endif
-/* Define the lowest bit set macro. Note, that this may be overridden
+/* Define the lowest bit set macro. Note, that this may be overridden
by a port specific definition if there is supporting assembly language
instructions in the architecture. */
-
+
#ifndef TX_LOWEST_SET_BIT_CALCULATE
static INLINE_DECLARE UINT _tx_thread_lowest_set_bit_calculate(ULONG map)
@@ -547,44 +547,44 @@ static INLINE_DECLARE UINT _tx_thread_lowest_set_bit_calculate(ULONG map)
UINT bit_set;
if ((map & ((ULONG) 0x1)) != ((ULONG) 0))
- {
- bit_set = ((UINT) 0);
- }
- else
- {
- map = map & (ULONG) ((~map) + ((ULONG) 1));
- if (map < ((ULONG) 0x100))
- {
- bit_set = ((UINT) 1);
- }
- else if (map < ((ULONG) 0x10000))
- {
- bit_set = ((UINT) 9);
- map = map >> ((UINT) 8);
- }
- else if (map < ((ULONG) 0x01000000))
- {
- bit_set = ((UINT) 17);
- map = map >> ((UINT) 16);
- }
- else
- {
- bit_set = ((UINT) 25);
- map = map >> ((UINT) 24);
- }
- if (map >= ((ULONG) 0x10))
- {
- map = map >> ((UINT) 4);
- bit_set = bit_set + ((UINT) 4);
- }
- if (map >= ((ULONG) 0x4))
- {
- map = map >> ((UINT) 2);
- bit_set = bit_set + ((UINT) 2);
- }
- bit_set = bit_set - (UINT) (map & (ULONG) 0x1);
+ {
+ bit_set = ((UINT) 0);
+ }
+ else
+ {
+ map = map & (ULONG) ((~map) + ((ULONG) 1));
+ if (map < ((ULONG) 0x100))
+ {
+ bit_set = ((UINT) 1);
+ }
+ else if (map < ((ULONG) 0x10000))
+ {
+ bit_set = ((UINT) 9);
+ map = map >> ((UINT) 8);
+ }
+ else if (map < ((ULONG) 0x01000000))
+ {
+ bit_set = ((UINT) 17);
+ map = map >> ((UINT) 16);
+ }
+ else
+ {
+ bit_set = ((UINT) 25);
+ map = map >> ((UINT) 24);
+ }
+ if (map >= ((ULONG) 0x10))
+ {
+ map = map >> ((UINT) 4);
+ bit_set = bit_set + ((UINT) 4);
+ }
+ if (map >= ((ULONG) 0x4))
+ {
+ map = map >> ((UINT) 2);
+ bit_set = bit_set + ((UINT) 2);
+ }
+ bit_set = bit_set - (UINT) (map & (ULONG) 0x1);
}
-
+
return(bit_set);
}
@@ -594,80 +594,80 @@ UINT bit_set;
#endif
-/* Define the next priority macro. Note, that this may be overridden
+/* Define the next priority macro. Note, that this may be overridden
by a port specific definition. */
-
+
#ifndef TX_NEXT_PRIORITY_FIND
#if TX_MAX_PRIORITIES > 32
-static INLINE_DECLARE UINT _tx_thread_smp_next_priority_find(UINT priority)
-{
-ULONG map_index;
-ULONG local_priority_map_active;
-ULONG local_priority_map;
-ULONG priority_bit;
-ULONG first_bit_set;
-ULONG found_priority;
+static INLINE_DECLARE UINT _tx_thread_smp_next_priority_find(UINT priority)
+{
+ULONG map_index;
+ULONG local_priority_map_active;
+ULONG local_priority_map;
+ULONG priority_bit;
+ULONG first_bit_set;
+ULONG found_priority;
- found_priority = ((UINT) TX_MAX_PRIORITIES);
- if (priority < ((UINT) TX_MAX_PRIORITIES))
- {
- map_index = priority/((UINT) 32);
- local_priority_map = _tx_thread_priority_maps[map_index];
- priority_bit = (((ULONG) 1) << (priority % ((UINT) 32)));
- local_priority_map = local_priority_map & ~(priority_bit - ((UINT)1));
- if (local_priority_map != ((ULONG) 0))
- {
- TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
- found_priority = (map_index * ((UINT) 32)) + first_bit_set;
- }
- else
- {
+ found_priority = ((UINT) TX_MAX_PRIORITIES);
+ if (priority < ((UINT) TX_MAX_PRIORITIES))
+ {
+ map_index = priority/((UINT) 32);
+ local_priority_map = _tx_thread_priority_maps[map_index];
+ priority_bit = (((ULONG) 1) << (priority % ((UINT) 32)));
+ local_priority_map = local_priority_map & ~(priority_bit - ((UINT)1));
+ if (local_priority_map != ((ULONG) 0))
+ {
+ TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
+ found_priority = (map_index * ((UINT) 32)) + first_bit_set;
+ }
+ else
+ {
/* Move to next map index. */
- map_index++;
- if (map_index < (((UINT) TX_MAX_PRIORITIES)/((UINT) 32)))
- {
- priority_bit = (((ULONG) 1) << (map_index));
- local_priority_map_active = _tx_thread_priority_map_active & ~(priority_bit - ((UINT) 1));
- if (local_priority_map_active != ((ULONG) 0))
- {
- TX_LOWEST_SET_BIT_CALCULATE(local_priority_map_active, map_index)
- local_priority_map = _tx_thread_priority_maps[map_index];
- TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
- found_priority = (map_index * ((UINT) 32)) + first_bit_set;
- }
- }
- }
- }
+ map_index++;
+ if (map_index < (((UINT) TX_MAX_PRIORITIES)/((UINT) 32)))
+ {
+ priority_bit = (((ULONG) 1) << (map_index));
+ local_priority_map_active = _tx_thread_priority_map_active & ~(priority_bit - ((UINT) 1));
+ if (local_priority_map_active != ((ULONG) 0))
+ {
+ TX_LOWEST_SET_BIT_CALCULATE(local_priority_map_active, map_index)
+ local_priority_map = _tx_thread_priority_maps[map_index];
+ TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
+ found_priority = (map_index * ((UINT) 32)) + first_bit_set;
+ }
+ }
+ }
+ }
return(found_priority);
}
#else
-static INLINE_DECLARE UINT _tx_thread_smp_next_priority_find(UINT priority)
-{
-UINT first_bit_set;
-ULONG local_priority_map;
+static INLINE_DECLARE UINT _tx_thread_smp_next_priority_find(UINT priority)
+{
+UINT first_bit_set;
+ULONG local_priority_map;
UINT next_priority;
- local_priority_map = _tx_thread_priority_maps[0];
- local_priority_map = local_priority_map >> priority;
+ local_priority_map = _tx_thread_priority_maps[0];
+ local_priority_map = local_priority_map >> priority;
next_priority = priority;
- if (local_priority_map == ((ULONG) 0))
- {
- next_priority = ((UINT) TX_MAX_PRIORITIES);
- }
- else
- {
- if (next_priority >= ((UINT) TX_MAX_PRIORITIES))
- {
- next_priority = ((UINT) TX_MAX_PRIORITIES);
- }
- else
- {
- TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
- next_priority = priority + first_bit_set;
- }
- }
-
+ if (local_priority_map == ((ULONG) 0))
+ {
+ next_priority = ((UINT) TX_MAX_PRIORITIES);
+ }
+ else
+ {
+ if (next_priority >= ((UINT) TX_MAX_PRIORITIES))
+ {
+ next_priority = ((UINT) TX_MAX_PRIORITIES);
+ }
+ else
+ {
+ TX_LOWEST_SET_BIT_CALCULATE(local_priority_map, first_bit_set)
+ next_priority = priority + first_bit_set;
+ }
+ }
+
return(next_priority);
}
#endif
@@ -693,7 +693,7 @@ UINT i;
#if TX_THREAD_SMP_MAX_CORES > 5
_tx_thread_smp_schedule_list[5] = TX_NULL;
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to clear the remainder of the schedule list. */
i = ((UINT) 6);
@@ -707,7 +707,7 @@ UINT i;
{
/* Clear entry in schedule list. */
_tx_thread_smp_schedule_list[i] = TX_NULL;
-
+
/* Move to next index. */
i++;
}
@@ -738,7 +738,7 @@ UINT j;
#if TX_THREAD_SMP_MAX_CORES > 5
_tx_thread_execute_ptr[5] = TX_NULL;
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to clear the remainder of the execute list. */
j = ((UINT) 6);
@@ -750,10 +750,10 @@ UINT j;
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Clear entry in execute list. */
_tx_thread_execute_ptr[j] = TX_NULL;
-
+
/* Move to next index. */
j++;
}
@@ -784,7 +784,7 @@ UINT j;
#if TX_THREAD_SMP_MAX_CORES > 5
_tx_thread_smp_schedule_list[5] = _tx_thread_execute_ptr[5];
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to setup the remainder of the schedule list. */
j = ((UINT) 6);
@@ -795,10 +795,10 @@ UINT j;
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Setup entry in schedule list. */
_tx_thread_smp_schedule_list[j] = _tx_thread_execute_ptr[j];
-
+
/* Move to next index. */
j++;
}
@@ -845,7 +845,7 @@ TX_THREAD *current_thread;
#else
/* Define to whitespace. */
-#define _tx_thread_smp_core_interrupt(a,b,c)
+#define _tx_thread_smp_core_interrupt(a,b,c)
#endif
@@ -854,7 +854,7 @@ TX_THREAD *current_thread;
static INLINE_DECLARE VOID _tx_thread_smp_core_wakeup(UINT current_core, UINT target_core)
{
- /* Determine if the core specified is not the current core - no need to wakeup the
+ /* Determine if the core specified is not the current core - no need to wakeup the
current core. */
if (target_core != current_core)
{
@@ -866,9 +866,9 @@ static INLINE_DECLARE VOID _tx_thread_smp_core_wakeup(UINT current_core, UINT t
#else
/* Define to whitespace. */
-#define _tx_thread_smp_core_wakeup(a,b)
+#define _tx_thread_smp_core_wakeup(a,b)
-#endif
+#endif
static INLINE_DECLARE VOID _tx_thread_smp_execute_list_setup(UINT core_index)
@@ -953,7 +953,7 @@ ULONG available_cores;
available_cores = available_cores | ((ULONG) 0x20);
}
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to setup the remainder of the schedule list. */
j = ((UINT) 6);
@@ -964,13 +964,13 @@ ULONG available_cores;
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Determine if this core is available. */
if (_tx_thread_execute_ptr[j] == TX_NULL)
{
available_cores = available_cores | (((ULONG) 1) << j);
}
-
+
/* Move to next core. */
j++;
}
@@ -1030,7 +1030,7 @@ TX_THREAD *thread_ptr;
possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed;
}
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to setup the remainder of the schedule list. */
j = ((UINT) 6);
@@ -1041,14 +1041,14 @@ TX_THREAD *thread_ptr;
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Determine if this core is available. */
thread_ptr = _tx_thread_execute_ptr[j];
if (thread_ptr != TX_NULL)
{
possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed;
}
-
+
/* Move to next core. */
j++;
}
@@ -1126,7 +1126,7 @@ UINT lowest_priority;
}
}
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to setup the remainder of the schedule list. */
j = ((UINT) 6);
@@ -1137,19 +1137,19 @@ UINT lowest_priority;
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Determine if this core has a thread scheduled. */
thread_ptr = _tx_thread_execute_ptr[j];
if (thread_ptr != TX_NULL)
{
-
+
/* Is this the new lowest priority? */
if (thread_ptr -> tx_thread_priority > lowest_priority)
{
lowest_priority = thread_ptr -> tx_thread_priority;
}
}
-
+
/* Move to next core. */
j++;
}
@@ -1175,31 +1175,31 @@ UINT core_queue[TX_THREAD_SMP_MAX_CORES-1];
TX_THREAD *thread_ptr;
TX_THREAD *last_thread;
TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
-
+
/* Clear the last thread cores in the search. */
last_thread_cores = ((ULONG) 0);
-
+
/* Set the last thread pointer to NULL. */
last_thread = TX_NULL;
-
+
/* Setup the core queue indices. */
queue_first = ((UINT) 0);
queue_last = ((UINT) 0);
-
- /* Build a list of possible cores for this thread to execute on, starting
+
+ /* 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;
if ((thread_possible_cores & (((ULONG) 1) << core)) != ((ULONG) 0))
{
-
+
/* Remember this potential mapping. */
thread_remap_list[core] = schedule_thread;
core_queue[queue_last] = core;
-
+
/* Move to next slot. */
queue_last++;
-
+
/* Clear this core. */
thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core);
}
@@ -1211,96 +1211,96 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
/* Determine the first possible core. */
test_cores = thread_possible_cores;
TX_LOWEST_SET_BIT_CALCULATE(test_cores, core)
-
+
/* Clear this core. */
thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core);
-
+
/* Remember this potential mapping. */
thread_remap_list[core] = schedule_thread;
core_queue[queue_last] = core;
-
+
/* Move to next slot. */
queue_last++;
- }
+ }
/* Loop to evaluate the potential thread mappings, against what is already mapped. */
- do
+ do
{
/* Pickup the next entry. */
core = core_queue[queue_first];
-
+
/* Move to next slot. */
queue_first++;
-
+
/* Retrieve the thread from the current mapping. */
thread_ptr = _tx_thread_smp_schedule_list[core];
/* Determine if there is a thread currently mapped to this core. */
if (thread_ptr != TX_NULL)
{
-
+
/* Determine the cores available for this thread. */
thread_possible_cores = thread_ptr -> tx_thread_smp_cores_allowed;
thread_possible_cores = test_possible_cores & thread_possible_cores;
-
+
/* Are there any possible cores for this thread? */
- if (thread_possible_cores != ((ULONG) 0))
+ if (thread_possible_cores != ((ULONG) 0))
{
-
+
/* Determine if there are cores available for this thread. */
if ((thread_possible_cores & available_cores) != ((ULONG) 0))
{
-
+
/* Yes, remember the final thread and cores that are valid for this thread. */
last_thread_cores = thread_possible_cores & available_cores;
last_thread = thread_ptr;
-
+
/* We are done - get out of the loop! */
break;
}
else
{
-
+
/* Remove cores that will be added to the list. */
test_possible_cores = test_possible_cores & ~(thread_possible_cores);
-
+
/* Loop to add this thread to the potential mapping list. */
- do
+ do
{
-
+
/* Calculate the core. */
test_cores = thread_possible_cores;
TX_LOWEST_SET_BIT_CALCULATE(test_cores, core)
-
+
/* Clear this core. */
thread_possible_cores = thread_possible_cores & ~(((ULONG) 1) << core);
-
+
/* Remember this thread for remapping. */
thread_remap_list[core] = thread_ptr;
-
+
/* Remember this core. */
core_queue[queue_last] = core;
-
+
/* Move to next slot. */
queue_last++;
-
+
} while (thread_possible_cores != ((ULONG) 0));
}
}
}
} while (queue_first != queue_last);
-
+
/* Was a remapping solution found? */
if (last_thread != TX_NULL)
{
-
+
/* Pickup the core of the last thread to remap. */
core = last_thread -> tx_thread_smp_core_mapped;
-
+
/* Pickup the thread from the remapping list. */
thread_ptr = thread_remap_list[core];
-
+
/* Loop until we arrive at the thread we have been trying to map. */
while (thread_ptr != schedule_thread)
{
@@ -1310,40 +1310,40 @@ TX_THREAD *thread_remap_list[TX_THREAD_SMP_MAX_CORES];
/* Remember the previous core. */
previous_core = core;
-
- /* Pickup the core of thread to remap. */
+
+ /* Pickup the core of thread to remap. */
core = thread_ptr -> tx_thread_smp_core_mapped;
-
+
/* Save the new core mapping for this thread. */
thread_ptr -> tx_thread_smp_core_mapped = previous_core;
-
+
/* Move the next thread. */
thread_ptr = thread_remap_list[core];
}
-
+
/* Save the remaining thread in the updated schedule list. */
_tx_thread_smp_schedule_list[core] = thread_ptr;
/* Update this thread's core mapping. */
thread_ptr -> tx_thread_smp_core_mapped = core;
-
+
/* Finally, setup the last thread in the remapping solution. */
test_cores = last_thread_cores;
TX_LOWEST_SET_BIT_CALCULATE(test_cores, core)
-
+
/* Setup the last thread. */
_tx_thread_smp_schedule_list[core] = last_thread;
-
+
/* Remember the core mapping for this thread. */
last_thread -> tx_thread_smp_core_mapped = core;
}
else
{
-
+
/* Set core to the maximum value in order to signal a remapping solution was not found. */
core = ((UINT) TX_THREAD_SMP_MAX_CORES);
}
-
+
/* Return core to the caller. */
return(core);
}
@@ -1373,7 +1373,7 @@ ULONG possible_cores = ((ULONG) 0);
#if TX_THREAD_SMP_MAX_CORES > 5
possible_preemption_list[5] = TX_NULL;
#if TX_THREAD_SMP_MAX_CORES > 6
-
+
/* Loop to clear the remainder of the possible preemption list. */
j = ((UINT) 6);
@@ -1385,10 +1385,10 @@ ULONG possible_cores = ((ULONG) 0);
while (j < _tx_thread_smp_max_cores)
#endif
{
-
+
/* Clear entry in possible preemption list. */
possible_preemption_list[j] = TX_NULL;
-
+
/* Move to next core. */
j++;
}
@@ -1412,18 +1412,18 @@ ULONG possible_cores = ((ULONG) 0);
/* Pickup the currently mapped thread. */
thread_ptr = _tx_thread_execute_ptr[i];
-
+
/* Is there a thread scheduled for this core? */
if (thread_ptr != TX_NULL)
{
-
+
/* Update the possible cores bit map. */
possible_cores = possible_cores | thread_ptr -> tx_thread_smp_cores_allowed;
/* Can this thread be preempted? */
if (priority < thread_ptr -> tx_thread_priority)
{
-
+
/* Thread that can be added to the preemption possible list. */
/* Yes, this scheduled thread is lower priority, so add it to the preemption possible list. */
@@ -1433,7 +1433,7 @@ ULONG possible_cores = ((ULONG) 0);
j++;
}
}
-
+
/* Move to next core. */
i++;
}
@@ -1446,7 +1446,7 @@ ULONG possible_cores = ((ULONG) 0);
i = ((UINT) 0);
do
{
-
+
/* Pickup preemptable thread. */
thread_ptr = possible_preemption_list[i];
@@ -1456,47 +1456,47 @@ ULONG possible_cores = ((ULONG) 0);
/* Loop to get the lowest priority thread at the front of the list. */
while (k < j)
{
-
+
/* Pickup the next thread to evaluate. */
next_thread = possible_preemption_list[k];
-
+
/* Is this thread lower priority? */
if (next_thread -> tx_thread_priority > thread_ptr -> tx_thread_priority)
{
-
+
/* Yes, swap the threads. */
possible_preemption_list[i] = next_thread;
possible_preemption_list[k] = thread_ptr;
thread_ptr = next_thread;
}
- else
+ else
{
/* Compare the thread priorities. */
if (next_thread -> tx_thread_priority == thread_ptr -> tx_thread_priority)
{
-
+
/* Equal priority threads... see which is in the ready list first. */
search_thread = thread_ptr -> tx_thread_ready_next;
-
+
/* Pickup the list head. */
list_head = _tx_thread_priority_list[thread_ptr -> tx_thread_priority];
-
+
/* Now loop to see if the next thread is after the current thread preemption. */
while (search_thread != list_head)
{
-
+
/* Have we found the next thread? */
if (search_thread == next_thread)
{
-
+
/* Yes, swap the threads. */
possible_preemption_list[i] = next_thread;
possible_preemption_list[k] = thread_ptr;
thread_ptr = next_thread;
break;
}
-
+
/* Move to the next thread. */
search_thread = search_thread -> tx_thread_ready_next;
}
@@ -1506,7 +1506,7 @@ ULONG possible_cores = ((ULONG) 0);
k++;
}
}
-
+
/* We have found the lowest priority thread to preempt, now find the next lowest. */
i++;
}
@@ -1522,15 +1522,15 @@ static INLINE_DECLARE VOID _tx_thread_smp_simple_priority_change(TX_THREAD *thr
UINT priority;
ULONG priority_bit;
-TX_THREAD *head_ptr;
-TX_THREAD *tail_ptr;
+TX_THREAD *head_ptr;
+TX_THREAD *tail_ptr;
#if TX_MAX_PRIORITIES > 32
UINT map_index;
#endif
/* Pickup the priority. */
priority = thread_ptr -> tx_thread_priority;
-
+
/* Determine if there are other threads at this priority that are
ready. */
if (thread_ptr -> tx_thread_ready_next != thread_ptr)
@@ -1553,7 +1553,7 @@ UINT map_index;
else
{
- /* This is the only thread at this priority ready to run. Set the head
+ /* This is the only thread at this priority ready to run. Set the head
pointer to NULL. */
_tx_thread_priority_list[priority] = TX_NULL;
@@ -1584,21 +1584,21 @@ UINT map_index;
case if the new priority is higher than the priority inheritance. */
if (new_priority < thread_ptr -> tx_thread_inherit_priority)
{
-
+
/* Change thread priority to the new user's priority. */
thread_ptr -> tx_thread_priority = new_priority;
thread_ptr -> tx_thread_preempt_threshold = new_priority;
}
else
{
-
+
/* Change thread priority to the priority inheritance. */
thread_ptr -> tx_thread_priority = thread_ptr -> tx_thread_inherit_priority;
thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_inherit_priority;
}
/* Now, place the thread at the new priority level. */
-
+
/* Determine if there are other threads at this priority that are
ready. */
head_ptr = _tx_thread_priority_list[new_priority];
@@ -1613,7 +1613,7 @@ UINT map_index;
head_ptr -> tx_thread_ready_previous = thread_ptr;
thread_ptr -> tx_thread_ready_previous = tail_ptr;
thread_ptr -> tx_thread_ready_next = head_ptr;
- }
+ }
else
{
@@ -1653,14 +1653,14 @@ VOID _tx_thread_smp_schedule_list_setup(void);
VOID _tx_thread_smp_core_interrupt(TX_THREAD *thread_ptr, UINT current_core, UINT target_core);
#else
/* Define to whitespace. */
-#define _tx_thread_smp_core_interrupt(a,b,c)
+#define _tx_thread_smp_core_interrupt(a,b,c)
#endif
#ifdef TX_THREAD_SMP_WAKEUP_LOGIC
VOID _tx_thread_smp_core_wakeup(UINT current_core, UINT target_core);
#else
/* Define to whitespace. */
-#define _tx_thread_smp_core_wakeup(a,b)
+#define _tx_thread_smp_core_wakeup(a,b)
#endif
VOID _tx_thread_smp_execute_list_setup(UINT core_index);