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 /** Event Flags */ 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_event_flags.h" 29 30 31 #ifndef TX_INLINE_INITIALIZATION 32 33 /* Locate event flags component data in this file. */ 34 /* Define the head pointer of the created event flags list. */ 35 36 TX_EVENT_FLAGS_GROUP * _tx_event_flags_created_ptr; 37 38 39 /* Define the variable that holds the number of created event flag groups. */ 40 41 ULONG _tx_event_flags_created_count; 42 43 44 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO 45 46 /* Define the total number of event flag sets. */ 47 48 ULONG _tx_event_flags_performance_set_count; 49 50 51 /* Define the total number of event flag gets. */ 52 53 ULONG _tx_event_flags_performance_get_count; 54 55 56 /* Define the total number of event flag suspensions. */ 57 58 ULONG _tx_event_flags_performance_suspension_count; 59 60 61 /* Define the total number of event flag timeouts. */ 62 63 ULONG _tx_event_flags_performance_timeout_count; 64 65 66 #endif 67 68 69 70 /**************************************************************************/ 71 /* */ 72 /* FUNCTION RELEASE */ 73 /* */ 74 /* _tx_event_flags_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 event flags 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_event_flags_initialize(VOID)113VOID _tx_event_flags_initialize(VOID) 114 { 115 116 #ifndef TX_DISABLE_REDUNDANT_CLEARING 117 118 /* Initialize the head pointer of the created event flags list and the 119 number of event flags created. */ 120 _tx_event_flags_created_ptr = TX_NULL; 121 _tx_event_flags_created_count = TX_EMPTY; 122 123 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO 124 125 /* Initialize event flags performance counters. */ 126 _tx_event_flags_performance_set_count = ((ULONG) 0); 127 _tx_event_flags_performance_get_count = ((ULONG) 0); 128 _tx_event_flags_performance_suspension_count = ((ULONG) 0); 129 _tx_event_flags_performance_timeout_count = ((ULONG) 0); 130 #endif 131 #endif 132 } 133 #endif 134