1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** ThreadX Component                                                     */
16 /**                                                                       */
17 /**   Timer - High Level SMP Support                                      */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define TX_SOURCE_CODE
23 #define TX_THREAD_SMP_SOURCE_CODE
24 
25 
26 /* Include necessary system files.  */
27 
28 #include "tx_api.h"
29 #include "tx_initialize.h"
30 #include "tx_timer.h"
31 #include "tx_thread.h"
32 
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _tx_timer_smp_core_exclude_get                     PROTABLE SMP     */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    William E. Lamie, Microsoft Corporation                             */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function returns the current exclusion list for the timer.     */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    timer_ptr                             Pointer to the timer          */
51 /*    exclusion_map_ptr                     Destination for the current   */
52 /*                                            exclusion list              */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    Status                                                              */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    None                                                                */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  09-30-2020     William E. Lamie         Initial Version 6.1           */
71 /*                                                                        */
72 /**************************************************************************/
_tx_timer_smp_core_exclude_get(TX_TIMER * timer_ptr,ULONG * exclusion_map_ptr)73 UINT  _tx_timer_smp_core_exclude_get(TX_TIMER *timer_ptr, ULONG *exclusion_map_ptr)
74 {
75 
76 UINT    status;
77 
78 
79     /* First, make sure the timer pointer is valid.  */
80     if (timer_ptr == TX_NULL)
81     {
82 
83         /* Return pointer error.  */
84         status =  TX_TIMER_ERROR;
85     }
86 
87     /* Check for valid ID.  */
88     else if (timer_ptr -> tx_timer_id != TX_TIMER_ID)
89     {
90 
91         /* Return pointer error.  */
92         status =  TX_TIMER_ERROR;
93     }
94 
95     /* Is the destination pointer NULL?  */
96     else if (exclusion_map_ptr == TX_NULL)
97     {
98 
99         /* Return pointer error.  */
100         status =  TX_PTR_ERROR;
101     }
102     else
103     {
104 
105         /* Save the current exclusion map in the destination.  */
106         *exclusion_map_ptr =  (timer_ptr -> tx_timer_internal.tx_timer_internal_smp_cores_excluded) & ((ULONG) TX_THREAD_SMP_CORE_MASK);
107 
108         /* Set the status to success.  */
109         status =  TX_SUCCESS;
110     }
111 
112     /* Return success.  */
113     return(status);
114 }
115 
116