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_event_flags.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _txe_event_flags_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 event flag information get   */
45 /*    service.                                                            */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    group_ptr                         Pointer to event flag group       */
50 /*    name                              Destination for the event flags   */
51 /*                                        group name                      */
52 /*    current_flags                     Current event flags               */
53 /*    first_suspended                   Destination for pointer of first  */
54 /*                                        thread suspended on event flags */
55 /*    suspended_count                   Destination for suspended count   */
56 /*    next_group                        Destination for pointer to next   */
57 /*                                        event flag group on the created */
58 /*                                        list                            */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    TX_GROUP_ERROR                    Invalid event flag group pointer  */
63 /*    status                            Completion status                 */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*    _tx_event_flags_info_get          Actual event flags group info     */
68 /*                                        get service                     */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
79 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
_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)83 UINT  _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
84                     TX_THREAD **first_suspended, ULONG *suspended_count,
85                     TX_EVENT_FLAGS_GROUP **next_group)
86 {
87 
88 UINT        status;
89 
90 
91     /* Check for an invalid event flag group pointer.  */
92     if (group_ptr == TX_NULL)
93     {
94 
95         /* Event flags group pointer is invalid, return appropriate error code.  */
96         status =  TX_GROUP_ERROR;
97     }
98 
99     /* Now check for invalid event flag group ID.  */
100     else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID)
101     {
102 
103         /* Event flags group pointer is invalid, return appropriate error code.  */
104         status =  TX_GROUP_ERROR;
105     }
106     else
107     {
108 
109         /* Otherwise, call the actual event flags group information get service.  */
110         status =  _tx_event_flags_info_get(group_ptr, name, current_flags, first_suspended,
111                                                             suspended_count, next_group);
112     }
113 
114     /* Return completion status.  */
115     return(status);
116 }
117 
118