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 #ifndef TX_INLINE_INITIALIZATION
33 
34 /* Locate event flags component data in this file.  */
35 /* Define the head pointer of the created event flags list.  */
36 
37 TX_EVENT_FLAGS_GROUP * _tx_event_flags_created_ptr;
38 
39 
40 /* Define the variable that holds the number of created event flag groups. */
41 
42 ULONG                  _tx_event_flags_created_count;
43 
44 
45 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
46 
47 /* Define the total number of event flag sets.  */
48 
49 ULONG                  _tx_event_flags_performance_set_count;
50 
51 
52 /* Define the total number of event flag gets.  */
53 
54 ULONG                  _tx_event_flags_performance_get_count;
55 
56 
57 /* Define the total number of event flag suspensions.  */
58 
59 ULONG                  _tx_event_flags_performance_suspension_count;
60 
61 
62 /* Define the total number of event flag timeouts.  */
63 
64 ULONG                  _tx_event_flags_performance_timeout_count;
65 
66 
67 #endif
68 
69 
70 
71 /**************************************************************************/
72 /*                                                                        */
73 /*  FUNCTION                                               RELEASE        */
74 /*                                                                        */
75 /*    _tx_event_flags_initialize                          PORTABLE C      */
76 /*                                                           6.1          */
77 /*  AUTHOR                                                                */
78 /*                                                                        */
79 /*    William E. Lamie, Microsoft Corporation                             */
80 /*                                                                        */
81 /*  DESCRIPTION                                                           */
82 /*                                                                        */
83 /*    This function initializes the various control data structures for   */
84 /*    the event flags component.                                          */
85 /*                                                                        */
86 /*  INPUT                                                                 */
87 /*                                                                        */
88 /*    None                                                                */
89 /*                                                                        */
90 /*  OUTPUT                                                                */
91 /*                                                                        */
92 /*    None                                                                */
93 /*                                                                        */
94 /*  CALLS                                                                 */
95 /*                                                                        */
96 /*    None                                                                */
97 /*                                                                        */
98 /*  CALLED BY                                                             */
99 /*                                                                        */
100 /*    _tx_initialize_high_level         High level initialization         */
101 /*                                                                        */
102 /*  RELEASE HISTORY                                                       */
103 /*                                                                        */
104 /*    DATE              NAME                      DESCRIPTION             */
105 /*                                                                        */
106 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
107 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
108 /*                                            opt out of function when    */
109 /*                                            TX_INLINE_INITIALIZATION is */
110 /*                                            defined,                    */
111 /*                                            resulting in version 6.1    */
112 /*                                                                        */
113 /**************************************************************************/
_tx_event_flags_initialize(VOID)114 VOID  _tx_event_flags_initialize(VOID)
115 {
116 
117 #ifndef TX_DISABLE_REDUNDANT_CLEARING
118 
119     /* Initialize the head pointer of the created event flags list and the
120        number of event flags created.  */
121     _tx_event_flags_created_ptr =        TX_NULL;
122     _tx_event_flags_created_count =      TX_EMPTY;
123 
124 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
125 
126     /* Initialize event flags performance counters.  */
127     _tx_event_flags_performance_set_count =         ((ULONG) 0);
128     _tx_event_flags_performance_get_count =         ((ULONG) 0);
129     _tx_event_flags_performance_suspension_count =  ((ULONG) 0);
130     _tx_event_flags_performance_timeout_count =     ((ULONG) 0);
131 #endif
132 #endif
133 }
134 #endif
135