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