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