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_MUTEX_INFO_GET_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_mutex_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 mutex information get        */
39 /*    service.                                                            */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    mutex_ptr                         Pointer to mutex control block    */
44 /*    name                              Destination for the mutex name    */
45 /*    count                             Destination for the owner count   */
46 /*    owner                             Destination for the owner's       */
47 /*                                        thread control block pointer    */
48 /*    first_suspended                   Destination for pointer of first  */
49 /*                                        thread suspended on the mutex   */
50 /*    suspended_count                   Destination for suspended count   */
51 /*    next_mutex                        Destination for pointer to next   */
52 /*                                        mutex on the created list       */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    TX_MUTEX_ERROR                    Invalid mutex pointer             */
57 /*    status                            Completion status                 */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*    _txm_module_kernel_call_dispatcher                                  */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Module application code                                             */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
72 /*  01-31-2022      Scott Larson            Modified comments and added   */
73 /*                                            CALL_NOT_USED option,       */
74 /*                                            resulting in version 6.1.10 */
75 /*                                                                        */
76 /**************************************************************************/
_txe_mutex_info_get(TX_MUTEX * mutex_ptr,CHAR ** name,ULONG * count,TX_THREAD ** owner,TX_THREAD ** first_suspended,ULONG * suspended_count,TX_MUTEX ** next_mutex)77 UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex)
78 {
79 
80 UINT return_value;
81 ALIGN_TYPE extra_parameters[5];
82 
83     extra_parameters[0] = (ALIGN_TYPE) count;
84     extra_parameters[1] = (ALIGN_TYPE) owner;
85     extra_parameters[2] = (ALIGN_TYPE) first_suspended;
86     extra_parameters[3] = (ALIGN_TYPE) suspended_count;
87     extra_parameters[4] = (ALIGN_TYPE) next_mutex;
88 
89     /* Call module manager dispatcher.  */
90     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_INFO_GET_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
91 
92     /* Return value to the caller.  */
93     return(return_value);
94 }
95 #endif
96