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