1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** ThreadX Component */
17 /** */
18 /** Thread - High Level SMP Support */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define TX_SOURCE_CODE
24 #define TX_THREAD_SMP_SOURCE_CODE
25
26
27 /* Include necessary system files. */
28
29 #include "tx_api.h"
30 #include "tx_initialize.h"
31 #include "tx_timer.h"
32 #include "tx_thread.h"
33
34
35
36 /**************************************************************************/
37 /* */
38 /* FUNCTION RELEASE */
39 /* */
40 /* _tx_thread_smp_current_state_set PORTABLE SMP */
41 /* 6.1 */
42 /* AUTHOR */
43 /* */
44 /* William E. Lamie, Microsoft Corporation */
45 /* */
46 /* DESCRIPTION */
47 /* */
48 /* This function is sets the current state to all of the cores. */
49 /* */
50 /* INPUT */
51 /* */
52 /* new_state New per-system state */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* None */
57 /* */
58 /* CALLS */
59 /* */
60 /* None */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* _tx_initialize_kernel_enter ThreadX entry */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 09-30-2020 William E. Lamie Initial Version 6.1 */
71 /* */
72 /**************************************************************************/
_tx_thread_smp_current_state_set(ULONG new_state)73 void _tx_thread_smp_current_state_set(ULONG new_state)
74 {
75
76 UINT i;
77
78 /* Initialize the state for each to initialization. */
79 i = ((UINT) (TX_THREAD_SMP_MAX_CORES-1));
80 do
81 {
82
83 /* Set this core's state. */
84 _tx_thread_system_state[i] = new_state;
85
86 if (i == ((UINT) 0))
87 {
88
89 /* We are finished, exit the loop. */
90 break;
91 }
92 else
93 {
94
95 /* Decrement the index. */
96 i--;
97 }
98 } while (TX_LOOP_FOREVER);
99 }
100
101