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 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   Utility                                                             */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /* Include necessary system files.  */
24 
25 #define UX_SOURCE_CODE
26 
27 #include "ux_api.h"
28 
29 
30 #if !defined(UX_STANDALONE)
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _ux_utility_event_flags_get                         PORTABLE C      */
36 /*                                                           6.1.11       */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Chaoqiong Xiao, Microsoft Corporation                               */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function get event flags from event flag group                 */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    group_ptr                             Event flag control group      */
48 /*    requested_flags                       32 bits variable event flags  */
49 /*    get_option                            AND/OR/CLEAR ... options      */
50 /*    actual_flag_ptr                       where the flags are placed    */
51 /*    wait_option                           waiting option                */
52 /*                                                                        */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    Completion Status                                                   */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    tx_event_flags_get                    ThreadX get event flag        */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    USBX Components                                                     */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
71 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
72 /*                                            used UX prefix to refer to  */
73 /*                                            TX symbols instead of using */
74 /*                                            them directly,              */
75 /*                                            resulting in version 6.1    */
76 /*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
77 /*                                            off in standalone build,    */
78 /*                                            resulting in version 6.1.11 */
79 /*                                                                        */
80 /**************************************************************************/
_ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP * group_ptr,ULONG requested_flags,UINT get_option,ULONG * actual_flags_ptr,ULONG wait_option)81 UINT  _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags,
82                                         UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option)
83 {
84 
85 UINT    status;
86 ULONG   local_actual_flags_ptr;
87 
88     /* Call ThreadX to get the event flags.  */
89     status =  tx_event_flags_get(group_ptr, requested_flags, get_option, &local_actual_flags_ptr, wait_option);
90 
91     /* Update the actual flags.  */
92     *actual_flags_ptr = local_actual_flags_ptr;
93 
94     /* Return completion status.  */
95     return(status);
96 }
97 #endif
98