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 /**   Module                                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TXM_MODULE
24 #include "txm_module.h"
25 #ifndef TXM_THREAD_INFO_GET_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_thread_info_get                                PORTABLE C      */
31 /*                                                           6.1.10       */
32 /*  AUTHOR                                                                */
33 /*                                                                        */
34 /*    Scott Larson, Microsoft Corporation                                 */
35 /*                                                                        */
36 /*  DESCRIPTION                                                           */
37 /*                                                                        */
38 /*    This function checks for errors in the thread information get       */
39 /*    service.                                                            */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    thread_ptr                        Pointer to thread control block   */
44 /*    name                              Destination for the thread name   */
45 /*    state                             Destination for thread state      */
46 /*    run_count                         Destination for thread run count  */
47 /*    priority                          Destination for thread priority   */
48 /*    preemption_threshold              Destination for thread preemption-*/
49 /*                                        threshold                       */
50 /*    time_slice                        Destination for thread time-slice */
51 /*    next_thread                       Destination for next created      */
52 /*                                        thread                          */
53 /*    next_suspended_thread             Destination for next suspended    */
54 /*                                        thread                          */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    TX_THREAD_ERROR                   Invalid thread pointer            */
59 /*    status                            Completion status                 */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _txm_module_kernel_call_dispatcher                                  */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Module application code                                             */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
74 /*  01-31-2022      Scott Larson            Modified comments and added   */
75 /*                                            CALL_NOT_USED option,       */
76 /*                                            resulting in version 6.1.10 */
77 /*                                                                        */
78 /**************************************************************************/
_txe_thread_info_get(TX_THREAD * thread_ptr,CHAR ** name,UINT * state,ULONG * run_count,UINT * priority,UINT * preemption_threshold,ULONG * time_slice,TX_THREAD ** next_thread,TX_THREAD ** next_suspended_thread)79 UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, UINT *priority, UINT *preemption_threshold, ULONG *time_slice, TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
80 {
81 
82 UINT return_value;
83 ALIGN_TYPE extra_parameters[7];
84 
85     extra_parameters[0] = (ALIGN_TYPE) state;
86     extra_parameters[1] = (ALIGN_TYPE) run_count;
87     extra_parameters[2] = (ALIGN_TYPE) priority;
88     extra_parameters[3] = (ALIGN_TYPE) preemption_threshold;
89     extra_parameters[4] = (ALIGN_TYPE) time_slice;
90     extra_parameters[5] = (ALIGN_TYPE) next_thread;
91     extra_parameters[6] = (ALIGN_TYPE) next_suspended_thread;
92 
93     /* Call module manager dispatcher.  */
94     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_INFO_GET_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
95 
96     /* Return value to the caller.  */
97     return(return_value);
98 }
99 #endif
100