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 /** Mutex */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define TX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "tx_api.h"
29 #include "tx_mutex.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _txe_mutex_info_get PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* William E. Lamie, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors in the mutex information get */
45 /* service. */
46 /* */
47 /* INPUT */
48 /* */
49 /* mutex_ptr Pointer to mutex control block */
50 /* name Destination for the mutex name */
51 /* count Destination for the owner count */
52 /* owner Destination for the owner's */
53 /* thread control block pointer */
54 /* first_suspended Destination for pointer of first */
55 /* thread suspended on the mutex */
56 /* suspended_count Destination for suspended count */
57 /* next_mutex Destination for pointer to next */
58 /* mutex on the created list */
59 /* */
60 /* OUTPUT */
61 /* */
62 /* TX_MUTEX_ERROR Invalid mutex pointer */
63 /* status Completion status */
64 /* */
65 /* CALLS */
66 /* */
67 /* _tx_mutex_info_get Actual mutex info get service */
68 /* */
69 /* CALLED BY */
70 /* */
71 /* Application Code */
72 /* */
73 /* RELEASE HISTORY */
74 /* */
75 /* DATE NAME DESCRIPTION */
76 /* */
77 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
78 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
79 /* resulting in version 6.1 */
80 /* */
81 /**************************************************************************/
_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)82 UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
83 TX_THREAD **first_suspended, ULONG *suspended_count,
84 TX_MUTEX **next_mutex)
85 {
86
87 UINT status;
88
89
90 /* Check for an invalid mutex pointer. */
91 if (mutex_ptr == TX_NULL)
92 {
93
94 /* Mutex pointer is invalid, return appropriate error code. */
95 status = TX_MUTEX_ERROR;
96 }
97
98 /* Now check for invalid mutex ID. */
99 else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID)
100 {
101
102 /* Mutex pointer is invalid, return appropriate error code. */
103 status = TX_MUTEX_ERROR;
104 }
105 else
106 {
107
108 /* Otherwise, call the actual mutex information get service. */
109 status = _tx_mutex_info_get(mutex_ptr, name, count, owner, first_suspended,
110 suspended_count, next_mutex);
111 }
112
113 /* Return completion status. */
114 return(status);
115 }
116
117