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 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _tx_thread_smp_core_exclude_get                    PROTABLE SMP     */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    William E. Lamie, Microsoft Corporation                             */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function returns the current exclusion list.                   */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    thread_ptr                            Pointer to the thread         */
52 /*    exclusion_map_ptr                     Destination for the current   */
53 /*                                            exclusion list              */
54 /*                                                                        */
55 /*  OUTPUT                                                                */
56 /*                                                                        */
57 /*    Status                                                              */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*    None                                                                */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Application Code                                                    */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  09-30-2020     William E. Lamie         Initial Version 6.1           */
72 /*                                                                        */
73 /**************************************************************************/
_tx_thread_smp_core_exclude_get(TX_THREAD * thread_ptr,ULONG * exclusion_map_ptr)74 UINT  _tx_thread_smp_core_exclude_get(TX_THREAD *thread_ptr, ULONG *exclusion_map_ptr)
75 {
76 
77 UINT    status;
78 
79 
80     /* First, make sure the thread pointer is valid.  */
81     if (thread_ptr == TX_NULL)
82     {
83 
84         /* Return pointer error.  */
85         status =  TX_THREAD_ERROR;
86     }
87 
88     /* Check for valid ID.  */
89     else if (thread_ptr -> tx_thread_id != TX_THREAD_ID)
90     {
91 
92         /* Return pointer error.  */
93         status =  TX_THREAD_ERROR;
94     }
95 
96     /* Is the destination pointer NULL?  */
97     else if (exclusion_map_ptr == TX_NULL)
98     {
99 
100         /* Return pointer error.  */
101         status =  TX_PTR_ERROR;
102     }
103     else
104     {
105 
106         /* Save the current exclusion map in the destination.  */
107         *exclusion_map_ptr =  thread_ptr -> tx_thread_smp_cores_excluded;
108 
109         /* Return a successful status.  */
110         status =  TX_SUCCESS;
111     }
112 
113     /* Return status.  */
114     return(status);
115 }
116 
117