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 /** Event Flags */
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_trace.h"
30 #include "tx_event_flags.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _tx_event_flags_info_get PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* William E. Lamie, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function retrieves information from the specified event flag */
46 /* group. */
47 /* */
48 /* INPUT */
49 /* */
50 /* group_ptr Pointer to event flag group */
51 /* name Destination for the event flag */
52 /* group name */
53 /* current_flags Current event flags */
54 /* first_suspended Destination for pointer of first */
55 /* thread suspended on event flags */
56 /* suspended_count Destination for suspended count */
57 /* next_group Destination for pointer to next */
58 /* event flag group on the created */
59 /* list */
60 /* */
61 /* OUTPUT */
62 /* */
63 /* status Completion status */
64 /* */
65 /* CALLS */
66 /* */
67 /* None */
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 /**************************************************************************/
_tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP * group_ptr,CHAR ** name,ULONG * current_flags,TX_THREAD ** first_suspended,ULONG * suspended_count,TX_EVENT_FLAGS_GROUP ** next_group)82 UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
83 TX_THREAD **first_suspended, ULONG *suspended_count,
84 TX_EVENT_FLAGS_GROUP **next_group)
85 {
86
87 TX_INTERRUPT_SAVE_AREA
88
89
90 /* Disable interrupts. */
91 TX_DISABLE
92
93 /* If trace is enabled, insert this event into the trace buffer. */
94 TX_TRACE_IN_LINE_INSERT(TX_TRACE_EVENT_FLAGS_INFO_GET, group_ptr, 0, 0, 0, TX_TRACE_EVENT_FLAGS_EVENTS)
95
96 /* Log this kernel call. */
97 TX_EL_EVENT_FLAGS_INFO_GET_INSERT
98
99 /* Retrieve all the pertinent information and return it in the supplied
100 destinations. */
101
102 /* Retrieve the name of the event flag group. */
103 if (name != TX_NULL)
104 {
105
106 *name = group_ptr -> tx_event_flags_group_name;
107 }
108
109 /* Retrieve the current event flags in the event flag group. */
110 if (current_flags != TX_NULL)
111 {
112
113 /* Pickup the current flags and apply delayed clearing. */
114 *current_flags = group_ptr -> tx_event_flags_group_current &
115 ~group_ptr -> tx_event_flags_group_delayed_clear;
116 }
117
118 /* Retrieve the first thread suspended on this event flag group. */
119 if (first_suspended != TX_NULL)
120 {
121
122 *first_suspended = group_ptr -> tx_event_flags_group_suspension_list;
123 }
124
125 /* Retrieve the number of threads suspended on this event flag group. */
126 if (suspended_count != TX_NULL)
127 {
128
129 *suspended_count = (ULONG) group_ptr -> tx_event_flags_group_suspended_count;
130 }
131
132 /* Retrieve the pointer to the next event flag group created. */
133 if (next_group != TX_NULL)
134 {
135
136 *next_group = group_ptr -> tx_event_flags_group_created_next;
137 }
138
139 /* Restore interrupts. */
140 TX_RESTORE
141
142 /* Return completion status. */
143 return(TX_SUCCESS);
144 }
145
146