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 /** Byte Pool */ 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_byte_pool.h" 30 31 32 #ifndef TX_INLINE_INITIALIZATION 33 34 /* Locate byte pool component data in this file. */ 35 36 /* Define the head pointer of the created byte pool list. */ 37 38 TX_BYTE_POOL * _tx_byte_pool_created_ptr; 39 40 41 /* Define the variable that holds the number of created byte pools. */ 42 43 ULONG _tx_byte_pool_created_count; 44 45 46 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO 47 48 /* Define the total number of allocates. */ 49 50 ULONG _tx_byte_pool_performance_allocate_count; 51 52 53 /* Define the total number of releases. */ 54 55 ULONG _tx_byte_pool_performance_release_count; 56 57 58 /* Define the total number of adjacent memory fragment merges. */ 59 60 ULONG _tx_byte_pool_performance_merge_count; 61 62 63 /* Define the total number of memory fragment splits. */ 64 65 ULONG _tx_byte_pool_performance_split_count; 66 67 68 /* Define the total number of memory fragments searched during allocation. */ 69 70 ULONG _tx_byte_pool_performance_search_count; 71 72 73 /* Define the total number of byte pool suspensions. */ 74 75 ULONG _tx_byte_pool_performance_suspension_count; 76 77 78 /* Define the total number of byte pool timeouts. */ 79 80 ULONG _tx_byte_pool_performance_timeout_count; 81 82 #endif 83 84 85 /**************************************************************************/ 86 /* */ 87 /* FUNCTION RELEASE */ 88 /* */ 89 /* _tx_byte_pool_initialize PORTABLE C */ 90 /* 6.1 */ 91 /* AUTHOR */ 92 /* */ 93 /* William E. Lamie, Microsoft Corporation */ 94 /* */ 95 /* DESCRIPTION */ 96 /* */ 97 /* This function initializes the various control data structures for */ 98 /* the byte pool component. */ 99 /* */ 100 /* INPUT */ 101 /* */ 102 /* None */ 103 /* */ 104 /* OUTPUT */ 105 /* */ 106 /* None */ 107 /* */ 108 /* CALLS */ 109 /* */ 110 /* None */ 111 /* */ 112 /* CALLED BY */ 113 /* */ 114 /* _tx_initialize_high_level High level initialization */ 115 /* */ 116 /* RELEASE HISTORY */ 117 /* */ 118 /* DATE NAME DESCRIPTION */ 119 /* */ 120 /* 05-19-2020 William E. Lamie Initial Version 6.0 */ 121 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 122 /* opt out of function when */ 123 /* TX_INLINE_INITIALIZATION is */ 124 /* defined, */ 125 /* resulting in version 6.1 */ 126 /* */ 127 /**************************************************************************/ _tx_byte_pool_initialize(VOID)128VOID _tx_byte_pool_initialize(VOID) 129 { 130 131 #ifndef TX_DISABLE_REDUNDANT_CLEARING 132 133 /* Initialize the head pointer of the created byte pools list and the 134 number of byte pools created. */ 135 _tx_byte_pool_created_ptr = TX_NULL; 136 _tx_byte_pool_created_count = TX_EMPTY; 137 138 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO 139 140 /* Initialize byte pool performance counters. */ 141 _tx_byte_pool_performance_allocate_count = ((ULONG) 0); 142 _tx_byte_pool_performance_release_count = ((ULONG) 0); 143 _tx_byte_pool_performance_merge_count = ((ULONG) 0); 144 _tx_byte_pool_performance_split_count = ((ULONG) 0); 145 _tx_byte_pool_performance_search_count = ((ULONG) 0); 146 _tx_byte_pool_performance_suspension_count = ((ULONG) 0); 147 _tx_byte_pool_performance_timeout_count = ((ULONG) 0); 148 #endif 149 #endif 150 } 151 #endif 152