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 /** Event Flags */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define TX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "tx_api.h"
28 #include "tx_event_flags.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _txe_event_flags_info_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* William E. Lamie, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks for errors in the event flag information get */
44 /* service. */
45 /* */
46 /* INPUT */
47 /* */
48 /* group_ptr Pointer to event flag group */
49 /* name Destination for the event flags */
50 /* group name */
51 /* current_flags Current event flags */
52 /* first_suspended Destination for pointer of first */
53 /* thread suspended on event flags */
54 /* suspended_count Destination for suspended count */
55 /* next_group Destination for pointer to next */
56 /* event flag group on the created */
57 /* list */
58 /* */
59 /* OUTPUT */
60 /* */
61 /* TX_GROUP_ERROR Invalid event flag group pointer */
62 /* status Completion status */
63 /* */
64 /* CALLS */
65 /* */
66 /* _tx_event_flags_info_get Actual event flags group info */
67 /* 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_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 _txe_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 UINT status;
88
89
90 /* Check for an invalid event flag group pointer. */
91 if (group_ptr == TX_NULL)
92 {
93
94 /* Event flags group pointer is invalid, return appropriate error code. */
95 status = TX_GROUP_ERROR;
96 }
97
98 /* Now check for invalid event flag group ID. */
99 else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID)
100 {
101
102 /* Event flags group pointer is invalid, return appropriate error code. */
103 status = TX_GROUP_ERROR;
104 }
105 else
106 {
107
108 /* Otherwise, call the actual event flags group information get service. */
109 status = _tx_event_flags_info_get(group_ptr, name, current_flags, first_suspended,
110 suspended_count, next_group);
111 }
112
113 /* Return completion status. */
114 return(status);
115 }
116
117